From a6570ebccf0c187f7b85487880ccf23f4a264eaa Mon Sep 17 00:00:00 2001 From: Brian Giori Date: Thu, 10 Oct 2024 10:25:13 -0700 Subject: [PATCH] chore: increase default test timeout --- packages/experiment-browser/jest.config.js | 1 + .../experiment-browser/test/client.test.ts | 44 +++++++++---------- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/packages/experiment-browser/jest.config.js b/packages/experiment-browser/jest.config.js index cadd7714..b853122b 100644 --- a/packages/experiment-browser/jest.config.js +++ b/packages/experiment-browser/jest.config.js @@ -15,4 +15,5 @@ module.exports = { transform: { '^.+\\.tsx?$': ['ts-jest', { tsconfig: './tsconfig.test.json' }], }, + testTimeout: 10 * 1000, }; diff --git a/packages/experiment-browser/test/client.test.ts b/packages/experiment-browser/test/client.test.ts index 235e9f53..4e7a81f8 100644 --- a/packages/experiment-browser/test/client.test.ts +++ b/packages/experiment-browser/test/client.test.ts @@ -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', () => {