Skip to content

Commit 6eaf0d3

Browse files
committed
make test more explicit
1 parent 8fd99a0 commit 6eaf0d3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

ab-testing/scripts/build/calculate-mvt-updates.test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ import {
66
import { ABTest } from '../../types.ts';
77
import { 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
1014
function 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

Comments
 (0)