Skip to content

Commit 32cafbf

Browse files
committed
fix tests
1 parent 2de4ab2 commit 32cafbf

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

packages/browser-sdk/test/features.test.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { testLogger } from "./testLogger";
1616
beforeEach(() => {
1717
vi.useFakeTimers();
1818
vi.resetAllMocks();
19+
localStorage.clear();
1920
});
2021

2122
afterAll(() => {
@@ -157,6 +158,7 @@ describe("FeaturesClient", () => {
157158
config: undefined,
158159
key: "huddle",
159160
isEnabledOverride: null,
161+
inUse: false,
160162
},
161163
});
162164
});
@@ -184,12 +186,14 @@ describe("FeaturesClient", () => {
184186
config: { key: "john", payload: { something: "else" } },
185187
key: "huddle",
186188
isEnabledOverride: null,
189+
inUse: false,
187190
},
188191
zoom: {
189192
isEnabled: true,
190193
config: undefined,
191194
key: "zoom",
192195
isEnabledOverride: null,
196+
inUse: false,
193197
},
194198
});
195199
});
@@ -342,7 +346,6 @@ describe("FeaturesClient", () => {
342346
test("handled overrides", async () => {
343347
// change the response so we can validate that we'll serve the stale cache
344348
const { newFeaturesClient } = featuresClientFactory();
345-
// localStorage.clear();
346349
const client = newFeaturesClient();
347350
await client.initialize();
348351

@@ -367,7 +370,6 @@ describe("FeaturesClient", () => {
367370
// change the response so we can validate that we'll serve the stale cache
368371
const { newFeaturesClient } = featuresClientFactory();
369372

370-
// localStorage.clear();
371373
const client = newFeaturesClient(undefined);
372374
await client.initialize();
373375

@@ -382,15 +384,19 @@ describe("FeaturesClient", () => {
382384
client.setFeatureOverride("featureC", true);
383385

384386
expect(updated).toBe(true);
385-
expect(client.getFeatures().featureC).toBeUndefined();
387+
expect(client.getFeatures().featureC).toEqual({
388+
isEnabled: false,
389+
isEnabledOverride: true,
390+
key: "featureC",
391+
inUse: false,
392+
} satisfies RawFeature);
386393
});
387394

388395
describe("in use", () => {
389396
it("handled in use", async () => {
390397
// change the response so we can validate that we'll serve the stale cache
391398
const { newFeaturesClient } = featuresClientFactory();
392399

393-
// localStorage.clear();
394400
const client = newFeaturesClient(undefined);
395401
await client.initialize();
396402

0 commit comments

Comments
 (0)