| 12 | |
| 13 | // Helper to create fresh flag data for each test |
| 14 | function createTestFlags(): Flag[] { |
| 15 | return [ |
| 16 | { |
| 17 | id: 'flag_abc123', |
| 18 | slug: 'my-feature', |
| 19 | description: 'My awesome feature flag', |
| 20 | kind: 'boolean', |
| 21 | state: 'active', |
| 22 | variants: [ |
| 23 | { id: 'off', value: false, label: 'Off' }, |
| 24 | { id: 'on', value: true, label: 'On' }, |
| 25 | ], |
| 26 | environments: { |
| 27 | production: { |
| 28 | active: false, // Disabled so we can enable it |
| 29 | fallthrough: { type: 'variant', variantId: 'off' }, |
| 30 | pausedOutcome: { type: 'variant', variantId: 'off' }, |
| 31 | rules: [], |
| 32 | }, |
| 33 | preview: { |
| 34 | active: true, |
| 35 | fallthrough: { type: 'variant', variantId: 'on' }, |
| 36 | pausedOutcome: { type: 'variant', variantId: 'off' }, |
| 37 | rules: [], |
| 38 | }, |
| 39 | development: { |
| 40 | active: false, // Disabled so we can enable it |
| 41 | fallthrough: { type: 'variant', variantId: 'on' }, |
| 42 | pausedOutcome: { type: 'variant', variantId: 'off' }, |
| 43 | rules: [], |
| 44 | }, |
| 45 | }, |
| 46 | createdAt: Date.now() - 86400000, |
| 47 | updatedAt: Date.now() - 3600000, |
| 48 | createdBy: 'user_123', |
| 49 | projectId: 'vercel-flags-test', |
| 50 | ownerId: 'team_dummy', |
| 51 | revision: 1, |
| 52 | seed: 12345, |
| 53 | typeName: 'flag', |
| 54 | }, |
| 55 | { |
| 56 | id: 'flag_def456', |
| 57 | slug: 'string-feature', |
| 58 | description: 'A string feature flag', |
| 59 | kind: 'string', |
| 60 | state: 'active', |
| 61 | variants: [ |
| 62 | { id: 'default', value: 'control', label: 'Control' }, |
| 63 | { id: 'variant-a', value: 'variant-a', label: 'Variant A' }, |
| 64 | ], |
| 65 | environments: { |
| 66 | production: { |
| 67 | active: false, |
| 68 | fallthrough: { type: 'variant', variantId: 'default' }, |
| 69 | pausedOutcome: { type: 'variant', variantId: 'default' }, |
| 70 | rules: [], |
| 71 | }, |