@@ -143,7 +143,7 @@ describe('ReactSDKClient', () => {
143
143
} ) ;
144
144
145
145
it ( 'fulfills the returned promise with success: true when a user is set' , async ( ) => {
146
- instance . setUser ( {
146
+ await instance . setUser ( {
147
147
id : 'user12345' ,
148
148
} ) ;
149
149
const result = await instance . onReady ( ) ;
@@ -164,7 +164,7 @@ describe('ReactSDKClient', () => {
164
164
} ) ;
165
165
166
166
it ( 'fulfills the returned promise with success: false when a user is set' , async ( ) => {
167
- instance . setUser ( {
167
+ await instance . setUser ( {
168
168
id : 'user12345' ,
169
169
} ) ;
170
170
const result = await instance . onReady ( ) ;
@@ -178,7 +178,7 @@ describe('ReactSDKClient', () => {
178
178
resolveInnerClientOnReady = res ;
179
179
} ) ;
180
180
mockInnerClientOnReady . mockReturnValueOnce ( mockReadyPromise ) ;
181
- instance . setUser ( {
181
+ await instance . setUser ( {
182
182
id : 'user999' ,
183
183
} ) ;
184
184
resolveInnerClientOnReady ! ( { success : true } ) ;
@@ -194,7 +194,7 @@ describe('ReactSDKClient', () => {
194
194
resolveInnerClientOnReady = res ;
195
195
} ) ;
196
196
mockInnerClientOnReady . mockReturnValueOnce ( mockReadyPromise ) ;
197
- instance . setUser ( {
197
+ await instance . setUser ( {
198
198
id : 'user999' ,
199
199
} ) ;
200
200
resolveInnerClientOnReady ! ( { success : true } ) ;
@@ -204,9 +204,9 @@ describe('ReactSDKClient', () => {
204
204
} ) ;
205
205
206
206
describe ( 'setUser' , ( ) => {
207
- it ( 'updates the user object with id and attributes' , ( ) => {
207
+ it ( 'updates the user object with id and attributes' , async ( ) => {
208
208
const instance = createInstance ( config ) ;
209
- instance . setUser ( {
209
+ await instance . setUser ( {
210
210
id : 'xxfueaojfe8&86' ,
211
211
attributes : {
212
212
foo : 'bar' ,
@@ -256,9 +256,9 @@ describe('ReactSDKClient', () => {
256
256
257
257
describe ( 'pre-set user and user overrides' , ( ) => {
258
258
let instance : ReactSDKClient ;
259
- beforeEach ( ( ) => {
259
+ beforeEach ( async ( ) => {
260
260
instance = createInstance ( config ) ;
261
- instance . setUser ( {
261
+ await instance . setUser ( {
262
262
id : 'user1' ,
263
263
attributes : {
264
264
foo : 'bar' ,
@@ -913,7 +913,7 @@ describe('ReactSDKClient', () => {
913
913
} ) ;
914
914
915
915
describe ( 'if Optimizely client is null' , ( ) => {
916
- it ( 'does not return an object with variables of all types returned from the inner sdk ' , ( ) => {
916
+ it ( 'does not return an object with variables of all types returned from the inner sdk ' , async ( ) => {
917
917
( mockInnerClient . getOptimizelyConfig as jest . Mock ) . mockReturnValue ( {
918
918
featuresMap : {
919
919
feat1 : {
@@ -971,7 +971,7 @@ describe('ReactSDKClient', () => {
971
971
}
972
972
) ;
973
973
const instance = createInstance ( config ) ;
974
- instance . setUser ( {
974
+ await instance . setUser ( {
975
975
id : 'user1123' ,
976
976
} ) ;
977
977
// @ts -ignore
@@ -981,7 +981,7 @@ describe('ReactSDKClient', () => {
981
981
} ) ;
982
982
} ) ;
983
983
984
- it ( 'returns an object with variables of all types returned from the inner sdk ' , ( ) => {
984
+ it ( 'returns an object with variables of all types returned from the inner sdk ' , async ( ) => {
985
985
( mockInnerClient . getOptimizelyConfig as jest . Mock ) . mockReturnValue ( {
986
986
featuresMap : {
987
987
feat1 : {
@@ -1039,7 +1039,7 @@ describe('ReactSDKClient', () => {
1039
1039
}
1040
1040
) ;
1041
1041
const instance = createInstance ( config ) ;
1042
- instance . setUser ( {
1042
+ await instance . setUser ( {
1043
1043
id : 'user1123' ,
1044
1044
} ) ;
1045
1045
const result = instance . getFeatureVariables ( 'feat1' ) ;
@@ -1057,7 +1057,7 @@ describe('ReactSDKClient', () => {
1057
1057
1058
1058
describe ( 'getAllFeatureVariables' , ( ) => {
1059
1059
describe ( 'if Optimizely client is null' , ( ) => {
1060
- it ( 'does not return an object with variables of all types returned from the inner sdk ' , ( ) => {
1060
+ it ( 'does not return an object with variables of all types returned from the inner sdk ' , async ( ) => {
1061
1061
const anyClient = mockInnerClient . getAllFeatureVariables as jest . Mock ;
1062
1062
anyClient . mockReturnValue ( {
1063
1063
bvar : true ,
@@ -1071,14 +1071,14 @@ describe('ReactSDKClient', () => {
1071
1071
const instance = createInstance ( config ) ;
1072
1072
// @ts -ignore
1073
1073
instance . _client = null ;
1074
- instance . setUser ( {
1074
+ await instance . setUser ( {
1075
1075
id : 'user1123' ,
1076
1076
} ) ;
1077
1077
const result = instance . getAllFeatureVariables ( 'feat1' , 'user1' ) ;
1078
1078
expect ( result ) . toEqual ( { } ) ;
1079
1079
} ) ;
1080
1080
1081
- it ( 'cannot use pre-set and override user for getAllFeatureVariables' , ( ) => {
1081
+ it ( 'cannot use pre-set and override user for getAllFeatureVariables' , async ( ) => {
1082
1082
const mockFn = mockInnerClient . getAllFeatureVariables as jest . Mock ;
1083
1083
mockFn . mockReturnValue ( {
1084
1084
bvar : true ,
@@ -1092,7 +1092,7 @@ describe('ReactSDKClient', () => {
1092
1092
const instance = createInstance ( config ) ;
1093
1093
// @ts -ignore
1094
1094
instance . _client = null ;
1095
- instance . setUser ( {
1095
+ await instance . setUser ( {
1096
1096
id : 'user1' ,
1097
1097
attributes : {
1098
1098
foo : 'bar' ,
@@ -1111,7 +1111,7 @@ describe('ReactSDKClient', () => {
1111
1111
expect ( result ) . toEqual ( { } ) ;
1112
1112
} ) ;
1113
1113
1114
- it ( 'returns an object with variables of all types returned from the inner sdk ' , ( ) => {
1114
+ it ( 'returns an object with variables of all types returned from the inner sdk ' , async ( ) => {
1115
1115
const anyClient = mockInnerClient . getAllFeatureVariables as jest . Mock ;
1116
1116
anyClient . mockReturnValue ( {
1117
1117
bvar : true ,
@@ -1123,7 +1123,7 @@ describe('ReactSDKClient', () => {
1123
1123
} ,
1124
1124
} ) ;
1125
1125
const instance = createInstance ( config ) ;
1126
- instance . setUser ( {
1126
+ await instance . setUser ( {
1127
1127
id : 'user1123' ,
1128
1128
} ) ;
1129
1129
const result = instance . getAllFeatureVariables ( 'feat1' , 'user1' ) ;
@@ -1138,7 +1138,7 @@ describe('ReactSDKClient', () => {
1138
1138
} ) ;
1139
1139
} ) ;
1140
1140
1141
- it ( 'can use pre-set and override user for getAllFeatureVariables' , ( ) => {
1141
+ it ( 'can use pre-set and override user for getAllFeatureVariables' , async ( ) => {
1142
1142
const mockFn = mockInnerClient . getAllFeatureVariables as jest . Mock ;
1143
1143
mockFn . mockReturnValue ( {
1144
1144
bvar : true ,
@@ -1150,7 +1150,7 @@ describe('ReactSDKClient', () => {
1150
1150
} ,
1151
1151
} ) ;
1152
1152
const instance = createInstance ( config ) ;
1153
- instance . setUser ( {
1153
+ await instance . setUser ( {
1154
1154
id : 'user1' ,
1155
1155
attributes : {
1156
1156
foo : 'bar' ,
@@ -1215,7 +1215,7 @@ describe('ReactSDKClient', () => {
1215
1215
} ) ;
1216
1216
1217
1217
it ( 'should return false if fetch fails' , async ( ) => {
1218
- instance . setUser ( {
1218
+ await instance . setUser ( {
1219
1219
id : 'user1' ,
1220
1220
} ) ;
1221
1221
@@ -1226,7 +1226,7 @@ describe('ReactSDKClient', () => {
1226
1226
} ) ;
1227
1227
1228
1228
it ( 'should return true if fetch successful' , async ( ) => {
1229
- instance . setUser ( {
1229
+ await instance . setUser ( {
1230
1230
id : 'user1' ,
1231
1231
} ) ;
1232
1232
@@ -1239,9 +1239,9 @@ describe('ReactSDKClient', () => {
1239
1239
1240
1240
describe ( 'onForcedVariationsUpdate' , ( ) => {
1241
1241
let instance : ReactSDKClient ;
1242
- beforeEach ( ( ) => {
1242
+ beforeEach ( async ( ) => {
1243
1243
instance = createInstance ( config ) ;
1244
- instance . setUser ( {
1244
+ await instance . setUser ( {
1245
1245
id : 'xxfueaojfe8&86' ,
1246
1246
attributes : {
1247
1247
foo : 'bar' ,
@@ -1293,10 +1293,10 @@ describe('ReactSDKClient', () => {
1293
1293
} ) ;
1294
1294
1295
1295
describe ( 'if Optimizely client is null' , ( ) => {
1296
- it ( 'should return false' , ( ) => {
1296
+ it ( 'should return false' , async ( ) => {
1297
1297
// @ts -ignore
1298
1298
instance . _client = null ;
1299
- instance . setUser ( {
1299
+ await instance . setUser ( {
1300
1300
id : 'user1' ,
1301
1301
} ) ;
1302
1302
const mockFn = mockOptimizelyUserContext . removeAllForcedDecisions as jest . Mock ;
@@ -1310,8 +1310,8 @@ describe('ReactSDKClient', () => {
1310
1310
} ) ;
1311
1311
} ) ;
1312
1312
1313
- it ( 'should return true if user context has been set ' , ( ) => {
1314
- instance . setUser ( {
1313
+ it ( 'should return true if user context has been set ' , async ( ) => {
1314
+ await instance . setUser ( {
1315
1315
id : 'user1' ,
1316
1316
} ) ;
1317
1317
const mockFn = mockOptimizelyUserContext . removeAllForcedDecisions as jest . Mock ;
@@ -1327,9 +1327,9 @@ describe('ReactSDKClient', () => {
1327
1327
1328
1328
describe ( 'setForcedDecision' , ( ) => {
1329
1329
let instance : ReactSDKClient ;
1330
- beforeEach ( ( ) => {
1330
+ beforeEach ( async ( ) => {
1331
1331
instance = createInstance ( config ) ;
1332
- instance . setUser ( {
1332
+ await instance . setUser ( {
1333
1333
id : 'user1' ,
1334
1334
attributes : {
1335
1335
foo : 'bar' ,
@@ -1436,9 +1436,9 @@ describe('ReactSDKClient', () => {
1436
1436
1437
1437
describe ( 'removeForcedDecision' , ( ) => {
1438
1438
let instance : ReactSDKClient ;
1439
- beforeEach ( ( ) => {
1439
+ beforeEach ( async ( ) => {
1440
1440
instance = createInstance ( config ) ;
1441
- instance . setUser ( {
1441
+ await instance . setUser ( {
1442
1442
id : 'user1' ,
1443
1443
attributes : {
1444
1444
foo : 'bar' ,
0 commit comments