@@ -87,16 +87,24 @@ final class FetchSuggestionTests: XCTestCase {
8787 XCTAssertEqual ( completions. first? . text, " Hello World \n " )
8888 }
8989
90- func test_if_language_identifier_is_unknown_returns_empty_array_immediately ( ) async throws {
90+ func test_if_language_identifier_is_unknown_returns_correctly ( ) async throws {
9191 struct Err : Error , LocalizedError {
9292 var errorDescription : String ? {
9393 " sendRequest Should not be falled "
9494 }
9595 }
9696
9797 class TestServer : CopilotLSP {
98- func sendRequest< E> ( _: E ) async throws -> E . Response where E: CopilotRequestType {
99- throw Err ( )
98+ func sendRequest< E> ( _ r: E ) async throws -> E . Response where E: CopilotRequestType {
99+ return CopilotRequest . GetCompletionsCycling. Response ( completions: [
100+ . init(
101+ text: " Hello World \n " ,
102+ position: . init( ( 0 , 0 ) ) ,
103+ uuid: " uuid " ,
104+ range: . init( start: . init( ( 0 , 0 ) ) , end: . init( ( 0 , 4 ) ) ) ,
105+ displayText: " Hello "
106+ ) ,
107+ ] ) as! E . Response
100108 }
101109 }
102110 let testServer = TestServer ( )
@@ -110,6 +118,7 @@ final class FetchSuggestionTests: XCTestCase {
110118 usesTabsForIndentation: false ,
111119 ignoreSpaceOnlySuggestions: false
112120 )
113- XCTAssertEqual ( completions. count, 0 )
121+ XCTAssertEqual ( completions. count, 1 )
122+ XCTAssertEqual ( completions. first? . text, " Hello World \n " )
114123 }
115124}
0 commit comments