Skip to content

Commit da124e3

Browse files
chore: add targeting key to flipt web tests (#1237)
Signed-off-by: Mark Phelps <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
1 parent 60e3590 commit da124e3

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

libs/providers/flipt-web/src/lib/flipt-web-provider.spec.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ describe('FliptWebProvider', () => {
2828
describe('method resolveStringEvaluation', () => {
2929
it('should throw general error for non-existent flag', () => {
3030
expect(() => {
31-
provider.resolveStringEvaluation('nonExistent', 'default', { fizz: 'buzz' });
31+
provider.resolveStringEvaluation('nonExistent', 'default', { targetingKey: '1234', fizz: 'buzz' });
3232
}).toThrow(GeneralError);
3333
});
3434

3535
it('should return right value if key exists', () => {
36-
const value = provider.resolveStringEvaluation('flag_string', 'default', { fizz: 'buzz' });
36+
const value = provider.resolveStringEvaluation('flag_string', 'default', { targetingKey: '1234', fizz: 'buzz' });
3737
expect(value).toHaveProperty('value', 'variant1');
3838
expect(value).toHaveProperty('reason', 'TARGETING_MATCH');
3939
});
@@ -42,12 +42,12 @@ describe('FliptWebProvider', () => {
4242
describe('method resolveNumberEvaluation', () => {
4343
it('should throw general error for non-existent flag', () => {
4444
expect(() => {
45-
provider.resolveNumberEvaluation('nonExistent', 1, { fizz: 'buzz' });
45+
provider.resolveNumberEvaluation('nonExistent', 1, { targetingKey: '1234', fizz: 'buzz' });
4646
}).toThrow(GeneralError);
4747
});
4848

4949
it('should return right value if key exists', () => {
50-
const value = provider.resolveNumberEvaluation('flag_number', 0, { fizz: 'buzz' });
50+
const value = provider.resolveNumberEvaluation('flag_number', 0, { targetingKey: '1234', fizz: 'buzz' });
5151
expect(value).toHaveProperty('value', 5);
5252
expect(value).toHaveProperty('reason', 'TARGETING_MATCH');
5353
});
@@ -56,12 +56,12 @@ describe('FliptWebProvider', () => {
5656
describe('method resolveBooleanEvaluation', () => {
5757
it('should throw general error for non-existent flag', () => {
5858
expect(() => {
59-
provider.resolveBooleanEvaluation('nonExistent', false, { fizz: 'buzz' });
59+
provider.resolveBooleanEvaluation('nonExistent', false, { targetingKey: '1234', fizz: 'buzz' });
6060
}).toThrow(GeneralError);
6161
});
6262

6363
it('should return right value if key exists', () => {
64-
const value = provider.resolveBooleanEvaluation('flag_boolean', false, { fizz: 'buzz' });
64+
const value = provider.resolveBooleanEvaluation('flag_boolean', false, { targetingKey: '1234', fizz: 'buzz' });
6565
expect(value).toHaveProperty('value', true);
6666
expect(value).toHaveProperty('reason', 'TARGETING_MATCH');
6767
});
@@ -70,20 +70,20 @@ describe('FliptWebProvider', () => {
7070
describe('method resolveObjectEvaluation', () => {
7171
it('should throw general error for non-existent flag', () => {
7272
expect(() => {
73-
provider.resolveObjectEvaluation('nonExistent', {}, { fizz: 'buzz' });
73+
provider.resolveObjectEvaluation('nonExistent', {}, { targetingKey: '1234', fizz: 'buzz' });
7474
}).toThrow(GeneralError);
7575
});
7676

7777
it('should return right value if key exists', () => {
78-
const value = provider.resolveObjectEvaluation('flag_object', { fizz: 'buzz' }, { fizz: 'buzz' });
78+
const value = provider.resolveObjectEvaluation('flag_object', { fizz: 'buzz' }, { targetingKey: '1234', fizz: 'buzz' });
7979
expect(value).toHaveProperty('value', { foo: 'bar' });
8080
expect(value).toHaveProperty('reason', 'TARGETING_MATCH');
8181
});
8282
});
8383

8484
it('should throw TypeMismatchError on non-number value', () => {
8585
expect(() => {
86-
provider.resolveNumberEvaluation('flag_string', 0, { fizz: 'buzz' });
86+
provider.resolveNumberEvaluation('flag_string', 0, { targetingKey: '1234', fizz: 'buzz' });
8787
}).toThrow(TypeMismatchError);
8888
});
8989
});

0 commit comments

Comments
 (0)