@@ -309,49 +309,39 @@ describe('EppoClient E2E test', () => {
309
309
describe ( 'onPreAssignment' , ( ) => {
310
310
it ( 'called with subject ID' , ( ) => {
311
311
const mockHooks = td . object < IAssignmentHooks > ( ) ;
312
- client . getAssignmentWithHooks ( 'subject-identifer' , experimentName , { } , mockHooks ) ;
312
+ client . getAssignmentWithHooks ( 'subject-identifer' , experimentName , mockHooks ) ;
313
313
expect ( td . explain ( mockHooks . onPreAssignment ) . callCount ) . toEqual ( 1 ) ;
314
314
expect ( td . explain ( mockHooks . onPreAssignment ) . calls [ 0 ] . args [ 0 ] ) . toEqual ( 'subject-identifer' ) ;
315
315
} ) ;
316
316
317
317
it ( 'overrides returned assignment' , async ( ) => {
318
- const variation = await client . getAssignmentWithHooks (
319
- 'subject-identifer' ,
320
- experimentName ,
321
- { } ,
322
- {
323
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
324
- onPreAssignment ( subject : string ) : Promise < string > {
325
- return Promise . resolve ( 'my-overridden-variation' ) ;
326
- } ,
318
+ const variation = await client . getAssignmentWithHooks ( 'subject-identifer' , experimentName , {
319
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
320
+ onPreAssignment ( subject : string ) : Promise < string > {
321
+ return Promise . resolve ( 'my-overridden-variation' ) ;
322
+ } ,
327
323
328
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
329
- onPostAssignment ( variation : string ) : Promise < void > {
330
- return Promise . resolve ( ) ;
331
- } ,
324
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
325
+ onPostAssignment ( variation : string ) : Promise < void > {
326
+ return Promise . resolve ( ) ;
332
327
} ,
333
- ) ;
328
+ } ) ;
334
329
335
330
expect ( variation ) . toEqual ( 'my-overridden-variation' ) ;
336
331
} ) ;
337
332
338
333
it ( 'uses regular assignment logic if onPreAssignment returns null' , async ( ) => {
339
- const variation = await client . getAssignmentWithHooks (
340
- 'subject-identifer' ,
341
- experimentName ,
342
- { } ,
343
- {
344
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
345
- onPreAssignment ( subject : string ) : Promise < string | null > {
346
- return Promise . resolve ( null ) ;
347
- } ,
334
+ const variation = await client . getAssignmentWithHooks ( 'subject-identifer' , experimentName , {
335
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
336
+ onPreAssignment ( subject : string ) : Promise < string | null > {
337
+ return Promise . resolve ( null ) ;
338
+ } ,
348
339
349
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
350
- onPostAssignment ( variation : string ) : Promise < void > {
351
- return Promise . resolve ( ) ;
352
- } ,
340
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
341
+ onPostAssignment ( variation : string ) : Promise < void > {
342
+ return Promise . resolve ( ) ;
353
343
} ,
354
- ) ;
344
+ } ) ;
355
345
356
346
expect ( variation ) . not . toEqual ( null ) ;
357
347
} ) ;
@@ -363,7 +353,6 @@ describe('EppoClient E2E test', () => {
363
353
const variation = await client . getAssignmentWithHooks (
364
354
'subject-identifer' ,
365
355
experimentName ,
366
- { } ,
367
356
mockHooks ,
368
357
) ;
369
358
expect ( td . explain ( mockHooks . onPostAssignment ) . callCount ) . toEqual ( 1 ) ;
0 commit comments