1717
1818import { expect } from 'chai' ;
1919
20- import { ListenerDataSource as Source } from '../../../src/core/event_manager' ;
2120import { EventsAccumulator } from '../util/events_accumulator' ;
2221import {
2322 addDoc ,
@@ -59,7 +58,7 @@ apiDescribe('Snapshot Listener source options ', persistence => {
5958 const storeEvent = new EventsAccumulator < QuerySnapshot > ( ) ;
6059 const unsubscribe = onSnapshot (
6160 coll ,
62- { source : Source . Cache } ,
61+ { source : 'cache' } ,
6362 storeEvent . storeEvent
6463 ) ;
6564
@@ -83,7 +82,7 @@ apiDescribe('Snapshot Listener source options ', persistence => {
8382 const storeEvent = new EventsAccumulator < DocumentSnapshot > ( ) ;
8483 const unsubscribe = onSnapshot (
8584 docRef ,
86- { source : Source . Cache } ,
85+ { source : 'cache' } ,
8786 storeEvent . storeEvent
8887 ) ;
8988
@@ -107,7 +106,7 @@ apiDescribe('Snapshot Listener source options ', persistence => {
107106 const storeEvent = new EventsAccumulator < QuerySnapshot > ( ) ;
108107 const unsubscribe = onSnapshot (
109108 coll ,
110- { includeMetadataChanges : true , source : Source . Cache } ,
109+ { includeMetadataChanges : true , source : 'cache' } ,
111110 storeEvent . storeEvent
112111 ) ;
113112
@@ -139,13 +138,13 @@ apiDescribe('Snapshot Listener source options ', persistence => {
139138 const storeEvent = new EventsAccumulator < QuerySnapshot > ( ) ;
140139 const unsubscribe1 = onSnapshot (
141140 testQuery ,
142- { source : Source . Cache } ,
141+ { source : 'cache' } ,
143142 storeEvent . storeEvent
144143 ) ;
145144
146145 const unsubscribe2 = onSnapshot (
147146 testQuery ,
148- { source : Source . Cache } ,
147+ { source : 'cache' } ,
149148 storeEvent . storeEvent
150149 ) ;
151150
@@ -207,15 +206,15 @@ apiDescribe('Snapshot Listener source options ', persistence => {
207206 const storeLimitEvent = new EventsAccumulator < QuerySnapshot > ( ) ;
208207 let limitUnlisten = onSnapshot (
209208 query ( coll , orderBy ( 'sort' , 'asc' ) , limit ( 2 ) ) ,
210- { source : Source . Cache } ,
209+ { source : 'cache' } ,
211210 storeLimitEvent . storeEvent
212211 ) ;
213212
214213 // Setup mirroring `limitToLast` query
215214 const storeLimitToLastEvent = new EventsAccumulator < QuerySnapshot > ( ) ;
216215 let limitToLastUnlisten = onSnapshot (
217216 query ( coll , orderBy ( 'sort' , 'desc' ) , limitToLast ( 2 ) ) ,
218- { source : Source . Cache } ,
217+ { source : 'cache' } ,
219218 storeLimitToLastEvent . storeEvent
220219 ) ;
221220
@@ -235,7 +234,7 @@ apiDescribe('Snapshot Listener source options ', persistence => {
235234 limitUnlisten ( ) ;
236235 limitUnlisten = onSnapshot (
237236 query ( coll , orderBy ( 'sort' , 'asc' ) , limit ( 2 ) ) ,
238- { source : Source . Cache } ,
237+ { source : 'cache' } ,
239238 storeLimitEvent . storeEvent
240239 ) ;
241240 snapshot = await storeLimitEvent . awaitEvent ( ) ;
@@ -269,7 +268,7 @@ apiDescribe('Snapshot Listener source options ', persistence => {
269268 await updateDoc ( doc ( coll , 'a' ) , { k : 'a' , sort : - 2 } ) ;
270269 limitToLastUnlisten = onSnapshot (
271270 query ( coll , orderBy ( 'sort' , 'desc' ) , limitToLast ( 2 ) ) ,
272- { source : Source . Cache } ,
271+ { source : 'cache' } ,
273272 storeLimitToLastEvent . storeEvent
274273 ) ;
275274
@@ -320,7 +319,7 @@ apiDescribe('Snapshot Listener source options ', persistence => {
320319 const storeCacheEvent = new EventsAccumulator < QuerySnapshot > ( ) ;
321320 const cacheUnlisten = onSnapshot (
322321 testQuery ,
323- { source : Source . Cache } ,
322+ { source : 'cache' } ,
324323 storeCacheEvent . storeEvent
325324 ) ;
326325 snapshot = await storeCacheEvent . awaitEvent ( ) ;
@@ -352,7 +351,7 @@ apiDescribe('Snapshot Listener source options ', persistence => {
352351
353352 const cacheUnlisten = onSnapshot (
354353 testQuery ,
355- { source : Source . Cache } ,
354+ { source : 'cache' } ,
356355 storeCacheEvent . storeEvent
357356 ) ;
358357 let snapshot = await storeCacheEvent . awaitEvent ( ) ;
@@ -401,7 +400,7 @@ apiDescribe('Snapshot Listener source options ', persistence => {
401400 const storeEvent = new EventsAccumulator < QuerySnapshot > ( ) ;
402401 const unsubscribe = onSnapshot (
403402 testQuery ,
404- { includeMetadataChanges : true , source : Source . Cache } ,
403+ { includeMetadataChanges : true , source : 'cache' } ,
405404 storeEvent . storeEvent
406405 ) ;
407406
@@ -443,7 +442,7 @@ apiDescribe('Snapshot Listener source options ', persistence => {
443442 const storeCacheEvent = new EventsAccumulator < QuerySnapshot > ( ) ;
444443 const cacheUnlisten = onSnapshot (
445444 testQuery ,
446- { includeMetadataChanges : true , source : Source . Cache } ,
445+ { includeMetadataChanges : true , source : 'cache' } ,
447446 storeCacheEvent . storeEvent
448447 ) ;
449448 let snapshot = await storeCacheEvent . awaitEvent ( ) ;
@@ -523,7 +522,7 @@ apiDescribe('Snapshot Listener source options ', persistence => {
523522 const storeCacheEvent = new EventsAccumulator < QuerySnapshot > ( ) ;
524523 const cacheUnlisten = onSnapshot (
525524 testQuery ,
526- { source : Source . Cache } ,
525+ { source : 'cache' } ,
527526 storeCacheEvent . storeEvent
528527 ) ;
529528 await storeCacheEvent . awaitEvent ( ) ;
@@ -568,7 +567,7 @@ apiDescribe('Snapshot Listener source options ', persistence => {
568567 const storeCacheEvent = new EventsAccumulator < QuerySnapshot > ( ) ;
569568 const cacheUnlisten = onSnapshot (
570569 testQuery ,
571- { source : Source . Cache } ,
570+ { source : 'cache' } ,
572571 storeCacheEvent . storeEvent
573572 ) ;
574573 await storeCacheEvent . awaitEvent ( ) ;
@@ -617,7 +616,7 @@ apiDescribe('Snapshot Listener source options ', persistence => {
617616 const storeCacheEvent = new EventsAccumulator < QuerySnapshot > ( ) ;
618617 let cacheUnlisten = onSnapshot (
619618 testQuery ,
620- { source : Source . Cache } ,
619+ { source : 'cache' } ,
621620 storeCacheEvent . storeEvent
622621 ) ;
623622 snapshot = await storeCacheEvent . awaitEvent ( ) ;
@@ -651,7 +650,7 @@ apiDescribe('Snapshot Listener source options ', persistence => {
651650
652651 cacheUnlisten = onSnapshot (
653652 testQuery ,
654- { source : Source . Cache } ,
653+ { source : 'cache' } ,
655654 storeCacheEvent . storeEvent
656655 ) ;
657656
@@ -679,7 +678,7 @@ apiDescribe('Snapshot Listener source options ', persistence => {
679678 const storeEvent = new EventsAccumulator < QuerySnapshot > ( ) ;
680679 const unsubscribe = onSnapshot (
681680 testQuery ,
682- { source : Source . Cache } ,
681+ { source : 'cache' } ,
683682 storeEvent . storeEvent
684683 ) ;
685684
@@ -695,7 +694,7 @@ apiDescribe('Snapshot Listener source options ', persistence => {
695694 expect ( toDataArray ( snapshot ) ) . to . deep . equal ( [ ] ) ; // Precondition check.
696695
697696 const storeEvent = new EventsAccumulator < QuerySnapshot > ( ) ;
698- onSnapshot ( coll , { source : Source . Cache } , storeEvent . storeEvent ) ;
697+ onSnapshot ( coll , { source : 'cache' } , storeEvent . storeEvent ) ;
699698 snapshot = await storeEvent . awaitEvent ( ) ;
700699 expect ( snapshot . metadata . fromCache ) . to . be . true ;
701700 expect ( toDataArray ( snapshot ) ) . to . deep . equal ( [ ] ) ;
@@ -707,7 +706,7 @@ apiDescribe('Snapshot Listener source options ', persistence => {
707706 const accumulator = new EventsAccumulator < QuerySnapshot > ( ) ;
708707 const unsubscribe = onSnapshot (
709708 coll ,
710- { source : Source . Cache } ,
709+ { source : 'cache' } ,
711710 accumulator . storeEvent
712711 ) ;
713712
@@ -752,7 +751,7 @@ apiDescribe('Snapshot Listener source options ', persistence => {
752751 const storeCacheEvent = new EventsAccumulator < QuerySnapshot > ( ) ;
753752 const cacheUnlisten = onSnapshot (
754753 testQuery ,
755- { source : Source . Cache } ,
754+ { source : 'cache' } ,
756755 storeCacheEvent . storeEvent
757756 ) ;
758757 snapshot = await storeCacheEvent . awaitEvent ( ) ;
0 commit comments