Skip to content
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

Improve testIgnoresTargetMappingAfterExistenceFilterMismatch #5880

Merged
merged 1 commit into from Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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