@@ -246,9 +246,13 @@ describe('EppoClient E2E test', () => {
246
246
} : IAssignmentTestCase ) => {
247
247
`---- Test Case for ${ experiment } Experiment ----` ;
248
248
249
- const assignments = subjectsWithAttributes
250
- ? getAssignmentsWithSubjectAttributes ( subjectsWithAttributes , experiment , valueType )
251
- : getAssignments ( subjects , experiment , valueType ) ;
249
+ const assignments = getAssignmentsWithSubjectAttributes (
250
+ subjectsWithAttributes
251
+ ? subjectsWithAttributes
252
+ : subjects . map ( ( subject ) => ( { subjectKey : subject } ) ) ,
253
+ experiment ,
254
+ valueType ,
255
+ ) ;
252
256
253
257
switch ( valueType ) {
254
258
case ValueTestType . BoolType : {
@@ -391,43 +395,11 @@ describe('EppoClient E2E test', () => {
391
395
expect ( assignment ) . toEqual ( 'control' ) ;
392
396
} ) ;
393
397
394
- function getAssignments (
395
- subjects : string [ ] ,
396
- experiment : string ,
397
- valueTestType : ValueTestType = ValueTestType . StringType ,
398
- ) : ( EppoValue | null ) [ ] {
399
- return subjects . map ( ( subjectKey ) => {
400
- switch ( valueTestType ) {
401
- case ValueTestType . BoolType : {
402
- const ba = globalClient . getBoolAssignment ( subjectKey , experiment ) ;
403
- if ( ba === null ) return null ;
404
- return EppoValue . Bool ( ba ) ;
405
- }
406
- case ValueTestType . NumericType : {
407
- const na = globalClient . getNumericAssignment ( subjectKey , experiment ) ;
408
- if ( na === null ) return null ;
409
- return EppoValue . Numeric ( na ) ;
410
- }
411
- case ValueTestType . StringType : {
412
- const sa = globalClient . getStringAssignment ( subjectKey , experiment ) ;
413
- if ( sa === null ) return null ;
414
- return EppoValue . String ( sa ) ;
415
- }
416
- case ValueTestType . JSONType : {
417
- const sa = globalClient . getJSONStringAssignment ( subjectKey , experiment ) ;
418
- const oa = globalClient . getParsedJSONAssignment ( subjectKey , experiment ) ;
419
- if ( oa == null || sa === null ) return null ;
420
- return EppoValue . JSON ( sa , oa ) ;
421
- }
422
- }
423
- } ) ;
424
- }
425
-
426
398
function getAssignmentsWithSubjectAttributes (
427
399
subjectsWithAttributes : {
428
400
subjectKey : string ;
429
401
// eslint-disable-next-line @typescript-eslint/no-explicit-any
430
- subjectAttributes : Record < string , any > ;
402
+ subjectAttributes ? : Record < string , any > ;
431
403
} [ ] ,
432
404
experiment : string ,
433
405
valueTestType : ValueTestType = ValueTestType . StringType ,
0 commit comments