Skip to content

Commit 7dbd361

Browse files
committed
CR changes
1 parent 264202c commit 7dbd361

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/client/eppo-precomputed-client-with-bandits.spec.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('EppoPrecomputedClient Bandits E2E test', () => {
2020
const obfuscatedConfigurationWire = readMockConfigurationWireResponse(MOCK_PRECOMPUTED_WIRE_FILE);
2121
const obfuscatedResponse = JSON.parse(obfuscatedConfigurationWire).precomputed.response;
2222

23-
const testModes = ['offline', 'online'] as const;
23+
const testModes = ['offline'];
2424

2525
testModes.forEach((mode) => {
2626
describe(`${mode} mode`, () => {
@@ -68,6 +68,7 @@ describe('EppoPrecomputedClient Bandits E2E test', () => {
6868
const parsed = JSON.parse(obfuscatedResponse);
6969
// Offline mode: directly populate stores with precomputed response
7070
precomputedFlagStore.salt = parsed.salt;
71+
precomputedBanditStore.salt = parsed.salt;
7172
await precomputedFlagStore.setEntries(parsed.flags);
7273
await precomputedBanditStore.setEntries(parsed.bandits);
7374
}
@@ -107,6 +108,16 @@ describe('EppoPrecomputedClient Bandits E2E test', () => {
107108
it('should return the assigned variation if a flag is not a bandit', () => {
108109
const precomputedConfiguration = client.getBanditAction('not-a-bandit-flag', 'default');
109110
expect(precomputedConfiguration).toEqual({ action: null, variation: 'control' });
111+
expect(mockLogBanditAction).not.toHaveBeenCalled();
112+
});
113+
114+
it('should return the bandit variation and action if a flag is a bandit', () => {
115+
const precomputedConfiguration = client.getBanditAction('string-flag', 'default');
116+
expect(precomputedConfiguration).toEqual({
117+
action: 'show_red_button',
118+
variation: 'red',
119+
});
120+
expect(mockLogBanditAction).toHaveBeenCalled();
110121
});
111122
});
112123
});

0 commit comments

Comments
 (0)