aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Example/Tests/Local
diff options
context:
space:
mode:
authorGravatar rsgowman <rich@gowman.noip.me>2017-11-22 17:01:26 -0500
committerGravatar GitHub <noreply@github.com>2017-11-22 17:01:26 -0500
commit793672432249b6f60667af72ef6594acaa93fe7c (patch)
tree61f3d4480064f76b1e8623e65bc6c0e4d38b7b14 /Firestore/Example/Tests/Local
parentda9308408d51a8b6659c50aec79be0b25b493d50 (diff)
Use a prefix scan when fetching documents matching a query. (#488)
Minor optimization (which is already present in the ts code).
Diffstat (limited to 'Firestore/Example/Tests/Local')
-rw-r--r--Firestore/Example/Tests/Local/FSTRemoteDocumentCacheTests.m6
1 files changed, 3 insertions, 3 deletions
diff --git a/Firestore/Example/Tests/Local/FSTRemoteDocumentCacheTests.m b/Firestore/Example/Tests/Local/FSTRemoteDocumentCacheTests.m
index e6ec699..16fe3bf 100644
--- a/Firestore/Example/Tests/Local/FSTRemoteDocumentCacheTests.m
+++ b/Firestore/Example/Tests/Local/FSTRemoteDocumentCacheTests.m
@@ -105,6 +105,8 @@ static const int kVersion = 42;
- (void)testDocumentsMatchingQuery {
if (!self.remoteDocumentCache) return;
+ // TODO(rsgowman): This just verifies that we do a prefix scan against the
+ // query path. We'll need more tests once we add index support.
[self setTestDocumentAtPath:@"a/1"];
[self setTestDocumentAtPath:@"b/1"];
[self setTestDocumentAtPath:@"b/2"];
@@ -114,12 +116,10 @@ static const int kVersion = 42;
FSTDocumentDictionary *results = [self.remoteDocumentCache documentsMatchingQuery:query];
NSArray *expected =
@[ FSTTestDoc(@"b/1", kVersion, _kDocData, NO), FSTTestDoc(@"b/2", kVersion, _kDocData, NO) ];
+ XCTAssertEqual([results count], [expected count]);
for (FSTDocument *doc in expected) {
XCTAssertEqualObjects([results objectForKey:doc.key], doc);
}
-
- // TODO(mikelehen): Perhaps guard against extra documents in the result set once our
- // implementations are smarter.
}
#pragma mark - Helpers