@@ -279,6 +279,86 @@ describe('Settings', () => {
279279 ) ;
280280 } ) ;
281281
282+ it ( 'long polling should be disabled by default' , ( ) => {
283+ // Use a new instance of Firestore in order to configure settings.
284+ const db = newTestFirestore ( ) ;
285+ expect ( db . _getSettings ( ) . experimentalAutoDetectLongPolling ) . to . be . false ;
286+ expect ( db . _getSettings ( ) . experimentalForceLongPolling ) . to . be . false ;
287+ } ) ;
288+
289+ it ( 'long polling should be in force mode if force=true' , ( ) => {
290+ // Use a new instance of Firestore in order to configure settings.
291+ const db = newTestFirestore ( ) ;
292+ db . _setSettings ( {
293+ experimentalForceLongPolling : true
294+ } ) ;
295+ expect ( db . _getSettings ( ) . experimentalAutoDetectLongPolling ) . to . be . false ;
296+ expect ( db . _getSettings ( ) . experimentalForceLongPolling ) . to . be . true ;
297+ } ) ;
298+
299+ it ( 'long polling should be in auto-detect mode if autoDetect=true' , ( ) => {
300+ // Use a new instance of Firestore in order to configure settings.
301+ const db = newTestFirestore ( ) ;
302+ db . _setSettings ( {
303+ experimentalAutoDetectLongPolling : true
304+ } ) ;
305+ expect ( db . _getSettings ( ) . experimentalAutoDetectLongPolling ) . to . be . true ;
306+ expect ( db . _getSettings ( ) . experimentalForceLongPolling ) . to . be . false ;
307+ } ) ;
308+
309+ it ( 'long polling should be disabled if force=false' , ( ) => {
310+ // Use a new instance of Firestore in order to configure settings.
311+ const db = newTestFirestore ( ) ;
312+ db . _setSettings ( {
313+ experimentalForceLongPolling : false
314+ } ) ;
315+ expect ( db . _getSettings ( ) . experimentalAutoDetectLongPolling ) . to . be . false ;
316+ expect ( db . _getSettings ( ) . experimentalForceLongPolling ) . to . be . false ;
317+ } ) ;
318+
319+ it ( 'long polling should be disabled if autoDetect=false' , ( ) => {
320+ // Use a new instance of Firestore in order to configure settings.
321+ const db = newTestFirestore ( ) ;
322+ db . _setSettings ( {
323+ experimentalAutoDetectLongPolling : false
324+ } ) ;
325+ expect ( db . _getSettings ( ) . experimentalAutoDetectLongPolling ) . to . be . false ;
326+ expect ( db . _getSettings ( ) . experimentalForceLongPolling ) . to . be . false ;
327+ } ) ;
328+
329+ it ( 'long polling should be in auto-detect mode if autoDetect=true and force=false' , ( ) => {
330+ // Use a new instance of Firestore in order to configure settings.
331+ const db = newTestFirestore ( ) ;
332+ db . _setSettings ( {
333+ experimentalAutoDetectLongPolling : true ,
334+ experimentalForceLongPolling : false
335+ } ) ;
336+ expect ( db . _getSettings ( ) . experimentalAutoDetectLongPolling ) . to . be . true ;
337+ expect ( db . _getSettings ( ) . experimentalForceLongPolling ) . to . be . false ;
338+ } ) ;
339+
340+ it ( 'long polling should be in force mode if autoDetect=false and force=true' , ( ) => {
341+ // Use a new instance of Firestore in order to configure settings.
342+ const db = newTestFirestore ( ) ;
343+ db . _setSettings ( {
344+ experimentalAutoDetectLongPolling : false ,
345+ experimentalForceLongPolling : true
346+ } ) ;
347+ expect ( db . _getSettings ( ) . experimentalAutoDetectLongPolling ) . to . be . false ;
348+ expect ( db . _getSettings ( ) . experimentalForceLongPolling ) . to . be . true ;
349+ } ) ;
350+
351+ it ( 'long polling should be disabled if autoDetect=false and force=false' , ( ) => {
352+ // Use a new instance of Firestore in order to configure settings.
353+ const db = newTestFirestore ( ) ;
354+ db . _setSettings ( {
355+ experimentalAutoDetectLongPolling : false ,
356+ experimentalForceLongPolling : false
357+ } ) ;
358+ expect ( db . _getSettings ( ) . experimentalAutoDetectLongPolling ) . to . be . false ;
359+ expect ( db . _getSettings ( ) . experimentalForceLongPolling ) . to . be . false ;
360+ } ) ;
361+
282362 it ( 'gets settings from useEmulator' , ( ) => {
283363 // Use a new instance of Firestore in order to configure settings.
284364 const db = newTestFirestore ( ) ;
0 commit comments