Skip to content

Commit f8994da

Browse files
committed
add tests for null being treated as falsy
1 parent 81a61b4 commit f8994da

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

packages/firestore/test/unit/api/database.test.ts

+20
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,16 @@ describe('Settings', () => {
379379
expect(db._getSettings().experimentalAutoDetectLongPolling).to.be.false;
380380
});
381381

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+
382392
it('long polling force=[something truthy] should be coerced to true', () => {
383393
// Use a new instance of Firestore in order to configure settings.
384394
const db = newTestFirestore();
@@ -399,6 +409,16 @@ describe('Settings', () => {
399409
expect(db._getSettings().experimentalForceLongPolling).to.be.false;
400410
});
401411

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+
402422
it('gets settings from useEmulator', () => {
403423
// Use a new instance of Firestore in order to configure settings.
404424
const db = newTestFirestore();

0 commit comments

Comments
 (0)