Skip to content

Commit be89e6e

Browse files
committed
update spec test
1 parent f1f47a7 commit be89e6e

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

packages/firestore/test/unit/specs/listen_spec.test.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,21 +1905,29 @@ describeSpec('Listens:', [], () => {
19051905
return (
19061906
client(0)
19071907
.becomeVisible()
1908-
// Listen to the first query in the primary client
19091908
.expectPrimaryState(true)
1909+
// Populate the cache first
19101910
.userListens(query1)
19111911
.watchAcksFull(query1, 1000, docA)
19121912
.expectEvents(query1, { added: [docA] })
1913+
.userUnlistens(query1)
1914+
.watchRemoves(query1)
1915+
// Listen to the query in the primary client
1916+
.userListens(query1, { resumeToken: 'resume-token-1000' })
1917+
.expectEvents(query1, {
1918+
added: [docA],
1919+
fromCache: true
1920+
})
1921+
.watchAcksFull(query1, 2000, docA)
1922+
.expectEvents(query1, { fromCache: false })
19131923
// Reproduces: https://github.com/firebase/firebase-js-sdk/issues/8314
1914-
// Watch could send existence filters along with a global snapshot.
1915-
// If existence filter matches, there will be no view changes, and query should not be
1916-
// marked as "not-current" as the Target is up to date.
1917-
.watchFilters([query1], [docA.key])
1918-
.watchSnapshots(2000, [], 'resume-token-2000')
1924+
// Watch could send a global snapshot from time to time. If there are no view changes,
1925+
// the query should not be marked as "not-current" as the Target is up to date.
1926+
.watchSnapshots(3000, [], 'resume-token-3000')
19191927
// Listen to the query in the secondary tab. The snapshot is up to date.
19201928
.client(1)
19211929
.userListens(query1)
1922-
.expectEvents(query1, { added: [docA] })
1930+
.expectEvents(query1, { added: [docA], fromCache: false })
19231931
);
19241932
}
19251933
);

0 commit comments

Comments
 (0)