-
Notifications
You must be signed in to change notification settings - Fork 730
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
Add initializer that takes database Connection #1330
Conversation
@mdarnall: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment I can fix post-merge if you'd prefer - otherwise looks good!
@@ -59,6 +60,12 @@ class CachePersistenceTests: XCTestCase { | |||
} | |||
} | |||
|
|||
func testPassInConnection() { | |||
let connection = try? Connection() | |||
XCTAssertNotNil(connection) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend making the test a throws
test so you don't have to mess around with unwrapping:
func testPassInConnection() throws {
let connection = try Connection()
let cache = try SQLiteNormalizedCache(db: connection)
// Something that tests that the cache exists
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sure I can update that.. thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@designatednerd I updated this to hopefully simplify, but didn't know if there was really a good way to "tests that the cache exists". Instead, I'm simply asserting the creation does not throw.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works too!
Because: - It will allow consumers to further configure the Connection in their application and pass it in - See: https://github.com/apollographql/apollo-ios/pull/1162/files#r410367735 This commit: - Adds a new initializer to SQLNormalizedCache
38acd17
to
d6a4d03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 pending CI
Updated SQLiteNormalizedCache
Because:
application and pass it in
This commit: