Skip to content

Commit

Permalink
chore: increase default test timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
bgiori committed Oct 10, 2024
1 parent 58446e2 commit a6570eb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 24 deletions.
1 change: 1 addition & 0 deletions packages/experiment-browser/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ module.exports = {
transform: {
'^.+\\.tsx?$': ['ts-jest', { tsconfig: './tsconfig.test.json' }],
},
testTimeout: 10 * 1000,
};
44 changes: 20 additions & 24 deletions packages/experiment-browser/test/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -676,30 +676,26 @@ describe('variant fallbacks', () => {
expect(spy.mock.calls[0][0].variant).toBeUndefined();
});

test(
'default variant returned when no other fallback is provided',
async () => {
const user = {};
const exposureTrackingProvider = new TestExposureTrackingProvider();
const spy = jest.spyOn(exposureTrackingProvider, 'track');
const client = new ExperimentClient(API_KEY, {
exposureTrackingProvider: exposureTrackingProvider,
source: Source.LocalStorage,
fetchOnStart: true,
});
mockClientStorage(client);
// Start and fetch
await client.start(user);
const variant = client.variant('sdk-ci-test');
expect(variant.key).toEqual('off');
expect(variant.value).toBeUndefined();
expect(variant.metadata?.default).toEqual(true);
expect(spy).toHaveBeenCalledTimes(1);
expect(spy.mock.calls[0][0].flag_key).toEqual('sdk-ci-test');
expect(spy.mock.calls[0][0].variant).toBeUndefined();
},
10 * 1000,
);
test('default variant returned when no other fallback is provided', async () => {
const user = {};
const exposureTrackingProvider = new TestExposureTrackingProvider();
const spy = jest.spyOn(exposureTrackingProvider, 'track');
const client = new ExperimentClient(API_KEY, {
exposureTrackingProvider: exposureTrackingProvider,
source: Source.LocalStorage,
fetchOnStart: true,
});
mockClientStorage(client);
// Start and fetch
await client.start(user);
const variant = client.variant('sdk-ci-test');
expect(variant.key).toEqual('off');
expect(variant.value).toBeUndefined();
expect(variant.metadata?.default).toEqual(true);
expect(spy).toHaveBeenCalledTimes(1);
expect(spy.mock.calls[0][0].flag_key).toEqual('sdk-ci-test');
expect(spy.mock.calls[0][0].variant).toBeUndefined();
});
});

describe('initial variants source', () => {
Expand Down

0 comments on commit a6570eb

Please sign in to comment.