-
Notifications
You must be signed in to change notification settings - Fork 731
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1962 from nsivertsen/nsivertsen/httpheader-public…
…-initializer Make initializer for ApolloSchemaDownloadConfiguration.HTTPHeader public
- Loading branch information
Showing
4 changed files
with
50 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import XCTest | ||
import ApolloTestSupport | ||
import ApolloCodegenTestSupport | ||
@testable import ApolloCodegenLib | ||
|
||
class ApolloSchemaInternalTests: XCTestCase { | ||
func testFormatConversion_givenIntrospectionJSON_shouldOutputValidSDL() throws { | ||
let bundle = Bundle(for: type(of: self)) | ||
guard let jsonURL = bundle.url(forResource: "introspection_response", withExtension: "json") else { | ||
throw XCTFailure("Missing resource file!", file: #file, line: #line) | ||
} | ||
|
||
try FileManager.default.apollo.createFolderIfNeeded(at: CodegenTestHelper.outputFolderURL()) | ||
let configuration = ApolloSchemaDownloadConfiguration(using: .introspection(endpointURL: TestURL.mockPort8080.url), | ||
outputFolderURL: CodegenTestHelper.outputFolderURL()) | ||
|
||
try ApolloSchemaDownloader.convertFromIntrospectionJSONToSDLFile(jsonFileURL: jsonURL, configuration: configuration) | ||
XCTAssertTrue(FileManager.default.apollo.fileExists(at: configuration.outputURL)) | ||
|
||
let frontend = try ApolloCodegenFrontend() | ||
let source = try frontend.makeSource(from: configuration.outputURL) | ||
let schema = try frontend.loadSchemaFromSDL(source) | ||
|
||
let authorType = try schema.getType(named: "Author") | ||
XCTAssertEqual(authorType?.name, "Author") | ||
|
||
let postType = try schema.getType(named: "Post") | ||
XCTAssertEqual(postType?.name, "Post") | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters