Skip to content

Commit 45732e3

Browse files
committedMar 5, 2025
AXON-201: fix tests
1 parent 99f90f5 commit 45732e3

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed
 

‎src/util/featureFlags/client.test.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,21 @@ describe('FeatureFlagClient', () => {
102102
expect(FeatureFlagClient.featureGates[featureName]).toBe(true);
103103
});
104104

105-
it('experiments default values are correctly assigned', async () => {
105+
it('experiments overrides are correctly applied', async () => {
106+
process.env.ATLASCODE_EXP_OVERRIDES_STRING = `${experimentName}=another value`;
106107
await FeatureFlagClient.initialize(options);
107-
expect(FeatureGates.getExperimentValue).toHaveBeenCalled();
108-
expect(Object.keys(FeatureFlagClient.experimentValues).length).toBe(1);
109108
expect(FeatureFlagClient.experimentValues[experimentName]).toBeDefined();
110-
expect(FeatureFlagClient.experimentValues[experimentName]).toBe('a default value');
109+
expect(FeatureFlagClient.experimentValues[experimentName]).toBe('another value');
111110
});
111+
});
112112

113-
it('experiments overrides are correctly applied', async () => {
114-
process.env.ATLASCODE_EXP_OVERRIDES_STRING = `${experimentName}=another value`;
113+
describe('checkExperimentValue', () => {
114+
it('should return the value of the experiment and save value in client', async () => {
115115
await FeatureFlagClient.initialize(options);
116+
const value = FeatureFlagClient.checkExperimentValue(experimentName);
116117
expect(FeatureFlagClient.experimentValues[experimentName]).toBeDefined();
117-
expect(FeatureFlagClient.experimentValues[experimentName]).toBe('another value');
118+
expect(FeatureFlagClient.experimentValues[experimentName]).toBe('a default value');
119+
expect(value).toBe('a default value');
118120
});
119121
});
120122
});

0 commit comments

Comments
 (0)
Failed to load comments.