Skip to content

Commit

Permalink
Improve testIgnoresTargetMappingAfterExistenceFilterMismatch (#5880)
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidt-sebastian committed Jan 11, 2022
1 parent c271d16 commit d0c8bfe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/firestore/test/unit/local/local_store.test.ts
Expand Up @@ -1936,7 +1936,9 @@ function genericLocalStoreTests(
.toContainTargetData(target, 10, 10, byteStringFromString('foo'))
// Create an existence filter mismatch and verify that the last limbo
// free snapshot version is deleted
.after(existenceFilterEvent(targetId, 2, 20))
.after(
existenceFilterEvent(targetId, documentKeySet(key('foo/a')), 2, 20)
)
.after(noChangeEvent(targetId, 20))
.toContainTargetData(target, 0, 0, ByteString.EMPTY_BYTE_STRING)
// Re-run the query as a collection scan
Expand Down
7 changes: 4 additions & 3 deletions packages/firestore/test/util/helpers.ts
Expand Up @@ -356,16 +356,17 @@ export function noChangeEvent(

export function existenceFilterEvent(
targetId: number,
count: number,
syncedKeys: DocumentKeySet,
remoteCount: number,
snapshotVersion: number
): RemoteEvent {
const aggregator = new WatchChangeAggregator({
getRemoteKeysForTarget: () => documentKeySet(),
getRemoteKeysForTarget: () => syncedKeys,
getTargetDataForTarget: targetId =>
targetData(targetId, TargetPurpose.Listen, 'foo')
});
aggregator.handleExistenceFilter(
new ExistenceFilterChange(targetId, new ExistenceFilter(count))
new ExistenceFilterChange(targetId, new ExistenceFilter(remoteCount))
);
return aggregator.createRemoteEvent(version(snapshotVersion));
}
Expand Down

0 comments on commit d0c8bfe

Please sign in to comment.