in ApolloTests/LoadQueryFromStoreTests.swift [70:92]
func testLoadingHeroNameQueryWithNullName() throws {
let initialRecords: RecordSet = [
"QUERY_ROOT": ["hero": Reference(key: "hero")],
"hero": ["__typename": "Droid", "name": NSNull()]
]
withCache(initialRecords: initialRecords) { (cache) in
store = ApolloStore(cache: cache)
let query = HeroNameQuery()
load(query: query) { (result, error) in
XCTAssertNil(result)
if case let error as GraphQLResultError = error {
XCTAssertEqual(error.path, ["hero", "name"])
XCTAssertMatch(error.underlying, JSONDecodingError.nullValue)
} else {
XCTFail("Unexpected error: \(String(describing: error))")
}
}
}
}