Skip to content

Commit 3e2be99

Browse files
committed
Firestore: database.test.ts: add tests for coercing experimentalForceLongPolling and experimentalAutoDetectLongPolling to boolean
1 parent 0832dca commit 3e2be99

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,42 @@ describe('Settings', () => {
359359
expect(db._getSettings().experimentalForceLongPolling).to.be.false;
360360
});
361361

362+
it('long polling autoDetect=[something truthy] is corced to true', () => {
363+
// Use a new instance of Firestore in order to configure settings.
364+
const db = newTestFirestore();
365+
db._setSettings({
366+
experimentalAutoDetectLongPolling: 1 as any,
367+
});
368+
expect(db._getSettings().experimentalAutoDetectLongPolling).to.be.true;
369+
});
370+
371+
it('long polling autoDetect=[something falsy] is corced to false', () => {
372+
// Use a new instance of Firestore in order to configure settings.
373+
const db = newTestFirestore();
374+
db._setSettings({
375+
experimentalAutoDetectLongPolling: 0 as any,
376+
});
377+
expect(db._getSettings().experimentalAutoDetectLongPolling).to.be.false;
378+
});
379+
380+
it('long polling force=[something truthy] is corced to true', () => {
381+
// Use a new instance of Firestore in order to configure settings.
382+
const db = newTestFirestore();
383+
db._setSettings({
384+
experimentalForceLongPolling: "I am truthy" as any,
385+
});
386+
expect(db._getSettings().experimentalForceLongPolling).to.be.true;
387+
});
388+
389+
it('long polling force=[something falsy] is corced to false', () => {
390+
// Use a new instance of Firestore in order to configure settings.
391+
const db = newTestFirestore();
392+
db._setSettings({
393+
experimentalForceLongPolling: NaN as any,
394+
});
395+
expect(db._getSettings().experimentalForceLongPolling).to.be.false;
396+
});
397+
362398
it('gets settings from useEmulator', () => {
363399
// Use a new instance of Firestore in order to configure settings.
364400
const db = newTestFirestore();

0 commit comments

Comments
 (0)