@@ -28,12 +28,12 @@ describe('FliptWebProvider', () => {
28
28
describe ( 'method resolveStringEvaluation' , ( ) => {
29
29
it ( 'should throw general error for non-existent flag' , ( ) => {
30
30
expect ( ( ) => {
31
- provider . resolveStringEvaluation ( 'nonExistent' , 'default' , { fizz : 'buzz' } ) ;
31
+ provider . resolveStringEvaluation ( 'nonExistent' , 'default' , { targetingKey : '1234' , fizz : 'buzz' } ) ;
32
32
} ) . toThrow ( GeneralError ) ;
33
33
} ) ;
34
34
35
35
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' } ) ;
37
37
expect ( value ) . toHaveProperty ( 'value' , 'variant1' ) ;
38
38
expect ( value ) . toHaveProperty ( 'reason' , 'TARGETING_MATCH' ) ;
39
39
} ) ;
@@ -42,12 +42,12 @@ describe('FliptWebProvider', () => {
42
42
describe ( 'method resolveNumberEvaluation' , ( ) => {
43
43
it ( 'should throw general error for non-existent flag' , ( ) => {
44
44
expect ( ( ) => {
45
- provider . resolveNumberEvaluation ( 'nonExistent' , 1 , { fizz : 'buzz' } ) ;
45
+ provider . resolveNumberEvaluation ( 'nonExistent' , 1 , { targetingKey : '1234' , fizz : 'buzz' } ) ;
46
46
} ) . toThrow ( GeneralError ) ;
47
47
} ) ;
48
48
49
49
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' } ) ;
51
51
expect ( value ) . toHaveProperty ( 'value' , 5 ) ;
52
52
expect ( value ) . toHaveProperty ( 'reason' , 'TARGETING_MATCH' ) ;
53
53
} ) ;
@@ -56,12 +56,12 @@ describe('FliptWebProvider', () => {
56
56
describe ( 'method resolveBooleanEvaluation' , ( ) => {
57
57
it ( 'should throw general error for non-existent flag' , ( ) => {
58
58
expect ( ( ) => {
59
- provider . resolveBooleanEvaluation ( 'nonExistent' , false , { fizz : 'buzz' } ) ;
59
+ provider . resolveBooleanEvaluation ( 'nonExistent' , false , { targetingKey : '1234' , fizz : 'buzz' } ) ;
60
60
} ) . toThrow ( GeneralError ) ;
61
61
} ) ;
62
62
63
63
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' } ) ;
65
65
expect ( value ) . toHaveProperty ( 'value' , true ) ;
66
66
expect ( value ) . toHaveProperty ( 'reason' , 'TARGETING_MATCH' ) ;
67
67
} ) ;
@@ -70,20 +70,20 @@ describe('FliptWebProvider', () => {
70
70
describe ( 'method resolveObjectEvaluation' , ( ) => {
71
71
it ( 'should throw general error for non-existent flag' , ( ) => {
72
72
expect ( ( ) => {
73
- provider . resolveObjectEvaluation ( 'nonExistent' , { } , { fizz : 'buzz' } ) ;
73
+ provider . resolveObjectEvaluation ( 'nonExistent' , { } , { targetingKey : '1234' , fizz : 'buzz' } ) ;
74
74
} ) . toThrow ( GeneralError ) ;
75
75
} ) ;
76
76
77
77
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' } ) ;
79
79
expect ( value ) . toHaveProperty ( 'value' , { foo : 'bar' } ) ;
80
80
expect ( value ) . toHaveProperty ( 'reason' , 'TARGETING_MATCH' ) ;
81
81
} ) ;
82
82
} ) ;
83
83
84
84
it ( 'should throw TypeMismatchError on non-number value' , ( ) => {
85
85
expect ( ( ) => {
86
- provider . resolveNumberEvaluation ( 'flag_string' , 0 , { fizz : 'buzz' } ) ;
86
+ provider . resolveNumberEvaluation ( 'flag_string' , 0 , { targetingKey : '1234' , fizz : 'buzz' } ) ;
87
87
} ) . toThrow ( TypeMismatchError ) ;
88
88
} ) ;
89
89
} ) ;
0 commit comments