Skip to content

Commit 09e9d04

Browse files
committed
One more test
1 parent 501a839 commit 09e9d04

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ describe('EppoPrecomputedClient E2E test', () => {
137137
);
138138
});
139139

140-
it('logs error when initialized with store without salt', () => {
140+
it('logs errors when constructor receives an uninitialized store without a salt', () => {
141141
const nonemptyStore = new MemoryOnlyConfigurationStore<PrecomputedFlag>();
142142
// Incorrectly initialized: no salt, not set to initialized
143143
jest.spyOn(nonemptyStore, 'getKeys').mockReturnValue(['some-key']);
@@ -156,6 +156,27 @@ describe('EppoPrecomputedClient E2E test', () => {
156156
'[Eppo SDK] EppoPrecomputedClient requires a precomputedFlagStore with a salt if requestParameters are not provided',
157157
);
158158
});
159+
160+
it('only logs initialization error when constructor receives an uninitialized store with salt', () => {
161+
const nonemptyStore = new MemoryOnlyConfigurationStore<PrecomputedFlag>();
162+
nonemptyStore.salt = 'nacl';
163+
// Incorrectly initialized: no salt, not set to initialized
164+
jest.spyOn(nonemptyStore, 'getKeys').mockReturnValue(['some-key']);
165+
166+
new EppoPrecomputedClient({
167+
precomputedFlagStore: nonemptyStore,
168+
subject: {
169+
subjectKey: '',
170+
subjectAttributes: {},
171+
},
172+
});
173+
expect(mockError).toHaveBeenCalledWith(
174+
'[Eppo SDK] EppoPrecomputedClient requires an initialized precomputedFlagStore if requestParameters are not provided',
175+
);
176+
expect(mockError).not.toHaveBeenCalledWith(
177+
'[Eppo SDK] EppoPrecomputedClient requires a precomputedFlagStore with a salt if requestParameters are not provided',
178+
);
179+
});
159180
});
160181

161182
describe('setLogger', () => {

0 commit comments

Comments
 (0)