@@ -359,6 +359,66 @@ describe('Settings', () => {
359359 expect ( db . _getSettings ( ) . experimentalForceLongPolling ) . to . be . false ;
360360 } ) ;
361361
362+ it ( 'long polling autoDetect=[something truthy] should be coerced to true' , ( ) => {
363+ // Use a new instance of Firestore in order to configure settings.
364+ const db = newTestFirestore ( ) ;
365+ db . _setSettings ( {
366+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
367+ experimentalAutoDetectLongPolling : 1 as any
368+ } ) ;
369+ expect ( db . _getSettings ( ) . experimentalAutoDetectLongPolling ) . to . be . true ;
370+ } ) ;
371+
372+ it ( 'long polling autoDetect=[something falsy] should be coerced to false' , ( ) => {
373+ // Use a new instance of Firestore in order to configure settings.
374+ const db = newTestFirestore ( ) ;
375+ db . _setSettings ( {
376+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
377+ experimentalAutoDetectLongPolling : 0 as any
378+ } ) ;
379+ expect ( db . _getSettings ( ) . experimentalAutoDetectLongPolling ) . to . be . false ;
380+ } ) ;
381+
382+ it ( 'long polling autoDetect=null should be coerced to false' , ( ) => {
383+ // Use a new instance of Firestore in order to configure settings.
384+ const db = newTestFirestore ( ) ;
385+ db . _setSettings ( {
386+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
387+ experimentalAutoDetectLongPolling : null as any
388+ } ) ;
389+ expect ( db . _getSettings ( ) . experimentalAutoDetectLongPolling ) . to . be . false ;
390+ } ) ;
391+
392+ it ( 'long polling force=[something truthy] should be coerced to true' , ( ) => {
393+ // Use a new instance of Firestore in order to configure settings.
394+ const db = newTestFirestore ( ) ;
395+ db . _setSettings ( {
396+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
397+ experimentalForceLongPolling : 'I am truthy' as any
398+ } ) ;
399+ expect ( db . _getSettings ( ) . experimentalForceLongPolling ) . to . be . true ;
400+ } ) ;
401+
402+ it ( 'long polling force=[something falsy] should be coerced to false' , ( ) => {
403+ // Use a new instance of Firestore in order to configure settings.
404+ const db = newTestFirestore ( ) ;
405+ db . _setSettings ( {
406+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
407+ experimentalForceLongPolling : NaN as any
408+ } ) ;
409+ expect ( db . _getSettings ( ) . experimentalForceLongPolling ) . to . be . false ;
410+ } ) ;
411+
412+ it ( 'long polling force=null should be coerced to false' , ( ) => {
413+ // Use a new instance of Firestore in order to configure settings.
414+ const db = newTestFirestore ( ) ;
415+ db . _setSettings ( {
416+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
417+ experimentalForceLongPolling : null as any
418+ } ) ;
419+ expect ( db . _getSettings ( ) . experimentalForceLongPolling ) . to . be . false ;
420+ } ) ;
421+
362422 it ( 'gets settings from useEmulator' , ( ) => {
363423 // Use a new instance of Firestore in order to configure settings.
364424 const db = newTestFirestore ( ) ;
0 commit comments