Skip to content

Commit d0c8bfe

Browse files
Improve testIgnoresTargetMappingAfterExistenceFilterMismatch (#5880)
1 parent c271d16 commit d0c8bfe

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

packages/firestore/test/unit/local/local_store.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1936,7 +1936,9 @@ function genericLocalStoreTests(
19361936
.toContainTargetData(target, 10, 10, byteStringFromString('foo'))
19371937
// Create an existence filter mismatch and verify that the last limbo
19381938
// free snapshot version is deleted
1939-
.after(existenceFilterEvent(targetId, 2, 20))
1939+
.after(
1940+
existenceFilterEvent(targetId, documentKeySet(key('foo/a')), 2, 20)
1941+
)
19401942
.after(noChangeEvent(targetId, 20))
19411943
.toContainTargetData(target, 0, 0, ByteString.EMPTY_BYTE_STRING)
19421944
// Re-run the query as a collection scan

packages/firestore/test/util/helpers.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,16 +356,17 @@ export function noChangeEvent(
356356

357357
export function existenceFilterEvent(
358358
targetId: number,
359-
count: number,
359+
syncedKeys: DocumentKeySet,
360+
remoteCount: number,
360361
snapshotVersion: number
361362
): RemoteEvent {
362363
const aggregator = new WatchChangeAggregator({
363-
getRemoteKeysForTarget: () => documentKeySet(),
364+
getRemoteKeysForTarget: () => syncedKeys,
364365
getTargetDataForTarget: targetId =>
365366
targetData(targetId, TargetPurpose.Listen, 'foo')
366367
});
367368
aggregator.handleExistenceFilter(
368-
new ExistenceFilterChange(targetId, new ExistenceFilter(count))
369+
new ExistenceFilterChange(targetId, new ExistenceFilter(remoteCount))
369370
);
370371
return aggregator.createRemoteEvent(version(snapshotVersion));
371372
}

0 commit comments

Comments
 (0)