Skip to content

Commit ec3721a

Browse files
Merge pull request #121 from samisuteria/kitchensink
add kitchen sink tests
2 parents a301134 + d69667f commit ec3721a

File tree

3 files changed

+37
-6
lines changed

3 files changed

+37
-6
lines changed

Package.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.2
1+
// swift-tools-version:5.4
22
import PackageDescription
33

44
let package = Package(
@@ -18,6 +18,13 @@ let package = Package(
1818
.product(name: "OrderedCollections", package: "swift-collections"),
1919
]
2020
),
21-
.testTarget(name: "GraphQLTests", dependencies: ["GraphQL"]),
21+
.testTarget(
22+
name: "GraphQLTests",
23+
dependencies: ["GraphQL"],
24+
resources: [
25+
.copy("LanguageTests/kitchen-sink.graphql"),
26+
.copy("LanguageTests/schema-kitchen-sink.graphql"),
27+
]
28+
),
2229
]
2330
)

Tests/GraphQLTests/LanguageTests/ParserTests.swift

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,20 @@ class ParserTests: XCTestCase {
249249
// });
250250
// });
251251

252+
enum ParserTestsError: Error {
253+
case couldNotFindKitchenSink
254+
}
255+
252256
func testKitchenSink() throws {
253-
// let path = "/Users/paulofaria/Development/Zewo/GraphQL/Tests/GraphQLTests/LanguageTests/kitchen-sink.graphql"
254-
// let kitchenSink = try NSString(contentsOfFile: path, encoding:
255-
// String.Encoding.utf8.rawValue)
256-
// _ = try parse(source: kitchenSink as String)
257+
guard
258+
let url = Bundle.module.url(forResource: "kitchen-sink", withExtension: "graphql"),
259+
let kitchenSink = try? String(contentsOf: url)
260+
else {
261+
XCTFail("Could not load kitchen sink")
262+
return
263+
}
264+
265+
_ = try parse(source: kitchenSink)
257266
}
258267

259268
func testNonKeywordAsName() throws {

Tests/GraphQLTests/LanguageTests/SchemaParserTests.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,4 +843,19 @@ class SchemaParserTests: XCTestCase {
843843
let result = try parse(source: source)
844844
XCTAssert(result == expected)
845845
}
846+
847+
func testKitchenSink() throws {
848+
guard
849+
let url = Bundle.module.url(
850+
forResource: "schema-kitchen-sink",
851+
withExtension: "graphql"
852+
),
853+
let kitchenSink = try? String(contentsOf: url)
854+
else {
855+
XCTFail("Could not load kitchen sink")
856+
return
857+
}
858+
859+
_ = try parse(source: kitchenSink)
860+
}
846861
}

0 commit comments

Comments
 (0)