-
Notifications
You must be signed in to change notification settings - Fork 944
Index-Free: Port LocalStore tests #2173
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
Index-Free: Port LocalStore tests #2173
Conversation
4f73ceb
to
944d455
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.
LGTM with nits.
@@ -324,9 +348,9 @@ export function docAddedRemoteEvent( | |||
doc | |||
); | |||
aggregator.handleDocumentChange(docChange); | |||
version = doc.version.compareTo(version) ? doc.version : version; |
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.
What does this do? It seems like doc.version.compareTo(version)
will be falsey iff the versions are equal and so this is equivalent to version = doc.version
. Or maybe you meant to implement something else?
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.
Let's see:
version = doc.version.compareTo(version) ? doc.version : version;
=>
version = doc.version != version ? doc.version : doc.version;
=>
version = doc.version
So you are right. It's a fancy way of picking the last version.
I rewrote it to pick the highest version instead.
* @param expectedCount.documentsByQuery The number of mutations read by | ||
* executing a query against the RemoteDocumentCache. | ||
* @param expectedCount.documentsByKey The number of documents read by | ||
* single-key lookups. |
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.
FWIW single-key is a bit misleading here and above since the count includes multi-key lookups as well (IFIUC).
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.
Changed to "document key lookups".
bec52ae
to
fdff9cd
Compare
6fc8eba
to
1aa22ac
Compare
…base-js-sdk into mrschmidt/indexfree-master
This ports the new LocalStore tests for Index-Free starting from https://github.com/firebase/firebase-android-sdk/blob/master/firebase-firestore/src/test/java/com/google/firebase/firestore/local/LocalStoreTestCase.java#L1035
During the porting, I realized that the new number of documents counter doesn't quite work (as predicted by @mikelehen). I had to modify it to differentiate between documents returned during query execution and documents read by single-key lookup.
I also added a second commit that uses it.skip instead of exiting out of tests early when
gcIsEager
is not set correctly. This ports some of the changes made to the Android LocalStore tests, but I just realized that there are still some test that exit early on Android. With that said, I don't feel very strongly about 944d445.