Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions packages/firestore/test/unit/api/database.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,66 @@ describe('Settings', () => {
expect(db._getSettings().experimentalForceLongPolling).to.be.false;
});

it('long polling autoDetect=[something truthy] should be coerced to true', () => {
// Use a new instance of Firestore in order to configure settings.
const db = newTestFirestore();
db._setSettings({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
experimentalAutoDetectLongPolling: 1 as any
});
expect(db._getSettings().experimentalAutoDetectLongPolling).to.be.true;
});

it('long polling autoDetect=[something falsy] should be coerced to false', () => {
// Use a new instance of Firestore in order to configure settings.
const db = newTestFirestore();
db._setSettings({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
experimentalAutoDetectLongPolling: 0 as any
});
expect(db._getSettings().experimentalAutoDetectLongPolling).to.be.false;
});

it('long polling autoDetect=null should be coerced to false', () => {
// Use a new instance of Firestore in order to configure settings.
const db = newTestFirestore();
db._setSettings({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
experimentalAutoDetectLongPolling: null as any
});
expect(db._getSettings().experimentalAutoDetectLongPolling).to.be.false;
});

it('long polling force=[something truthy] should be coerced to true', () => {
// Use a new instance of Firestore in order to configure settings.
const db = newTestFirestore();
db._setSettings({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
experimentalForceLongPolling: 'I am truthy' as any
});
expect(db._getSettings().experimentalForceLongPolling).to.be.true;
});

it('long polling force=[something falsy] should be coerced to false', () => {
// Use a new instance of Firestore in order to configure settings.
const db = newTestFirestore();
db._setSettings({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
experimentalForceLongPolling: NaN as any
});
expect(db._getSettings().experimentalForceLongPolling).to.be.false;
});

it('long polling force=null should be coerced to false', () => {
// Use a new instance of Firestore in order to configure settings.
const db = newTestFirestore();
db._setSettings({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
experimentalForceLongPolling: null as any
});
expect(db._getSettings().experimentalForceLongPolling).to.be.false;
});

it('gets settings from useEmulator', () => {
// Use a new instance of Firestore in order to configure settings.
const db = newTestFirestore();
Expand Down