@@ -6,17 +6,17 @@ import {
66import { ABTest } from '../../types.ts' ;
77import { AudienceSpace , AllSpace , FastlyTestParams } from '../lib/types.ts' ;
88
9+ const tomorrow = new Date ( Date . now ( ) + 24 * 60 * 60 * 1000 )
10+ . toISOString ( )
11+ . split ( 'T' ) [ 0 ] as ABTest [ 'expirationDate' ] ; // Format as YYYY-MM-DD
12+
913// Helper function to create mock ABTest
1014function createMockABTest ( name : string , options : Partial < ABTest > = { } ) : ABTest {
1115 return {
1216 name : name as ABTest [ 'name' ] , // Cast to satisfy TestName type
1317 description : options . description || `Test ${ name } ` ,
1418 owners : options . owners || [ 'test@example.com' ] ,
15- expirationDate :
16- options . expirationDate ||
17- ( new Date ( Date . now ( ) + 86400000 )
18- . toISOString ( )
19- . split ( 'T' ) [ 0 ] as ABTest [ 'expirationDate' ] ) , // 24 hours from now
19+ expirationDate : options . expirationDate || tomorrow , // 24 hours from now
2020 type : options . type || 'server' ,
2121 status : options . status || 'ON' ,
2222 audienceSize : options . audienceSize || 0.1 , // 10% of audience
@@ -616,6 +616,7 @@ Deno.test(
616616 audienceSize : 0.002 ,
617617 groups : [ 'control' , 'variant' ] ,
618618 status : 'OFF' , // Test is switched off
619+ expirationDate : tomorrow , // Future date, but should be ignored
619620 } ) ,
620621 ] ;
621622
0 commit comments