-
Notifications
You must be signed in to change notification settings - Fork 749
Fix SQLite Cache Key Bug #991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -319,7 +319,44 @@ class LoadQueryFromStoreTests: XCTestCase { | |
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
| func testLoadingQueryWithFloats() throws { | ||
| let starshipLength = 1234.5 | ||
|
|
||
| let initialRecords: RecordSet = [ | ||
| "QUERY_ROOT": ["starshipLength(length:1234.5)": Reference(key: "starshipLength(length:1234.5)")], | ||
| "starshipLength(length:1234.5)": ["__typename": "Starship", | ||
| "name": "Millennium Falcon", | ||
| "length": starshipLength, | ||
| "coordinates": [[0.0,1.0], [2.0,3.0]]] | ||
| ] | ||
|
|
||
|
|
||
| withCache(initialRecords: initialRecords) { (cache) in | ||
| store = ApolloStore(cache: cache) | ||
|
|
||
| let query = StarshipLengthQuery(length: starshipLength) | ||
|
|
||
| load(query: query) { result in | ||
| switch result { | ||
| case .success(let graphQLResult): | ||
| XCTAssertNil(graphQLResult.errors) | ||
|
|
||
| guard let data = graphQLResult.data else { | ||
| XCTFail("No data returned with result") | ||
| return | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe I'm missing something but I don't think I can use that in the completion block.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't had an issue with that in other tests
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not used in completion blocks anywhere else, it seems like this test file uses the completion block with XCTFail pattern for all the tests.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no worries i'll fight with this once this is merged |
||
|
|
||
| XCTAssertEqual(data.starshipLength?.name, "Millennium Falcon") | ||
| XCTAssertEqual(data.starshipLength?.length, starshipLength) | ||
|
giantramen marked this conversation as resolved.
Outdated
|
||
| case .failure(let error): | ||
| XCTFail("Unexpected error: \(error)") | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // MARK: - Helpers | ||
|
|
||
| private func load<Query: GraphQLQuery>(query: Query, resultHandler: @escaping GraphQLResultHandler<Query.Data>) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.