@@ -1905,21 +1905,29 @@ describeSpec('Listens:', [], () => {
1905
1905
return (
1906
1906
client ( 0 )
1907
1907
. becomeVisible ( )
1908
- // Listen to the first query in the primary client
1909
1908
. expectPrimaryState ( true )
1909
+ // Populate the cache first
1910
1910
. userListens ( query1 )
1911
1911
. watchAcksFull ( query1 , 1000 , docA )
1912
1912
. 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 } )
1913
1923
// 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' )
1919
1927
// Listen to the query in the secondary tab. The snapshot is up to date.
1920
1928
. client ( 1 )
1921
1929
. userListens ( query1 )
1922
- . expectEvents ( query1 , { added : [ docA ] } )
1930
+ . expectEvents ( query1 , { added : [ docA ] , fromCache : false } )
1923
1931
) ;
1924
1932
}
1925
1933
) ;
0 commit comments