Skip to content

Commit 894af95

Browse files
[FSSDK-11529] test data update
1 parent fc8181f commit 894af95

File tree

1 file changed

+30
-76
lines changed

1 file changed

+30
-76
lines changed

lib/optimizely/index.spec.ts

Lines changed: 30 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,33 @@ import { newErrorDecision } from '../optimizely_decision';
3131
import { ImpressionEvent } from '../event_processor/event_builder/user_event';
3232
import { OptimizelyDecideOption } from '../shared_types';
3333

34+
35+
const holdoutData = [
36+
{
37+
id: 'holdout_test_id',
38+
key: 'holdout_test_key',
39+
status: 'Running',
40+
includeFlags: [],
41+
excludeFlags: [],
42+
audienceIds: [],
43+
audienceConditions: [],
44+
variations: [
45+
{
46+
id: 'holdout_variation_id',
47+
key: 'holdout_variation_key',
48+
variables: [],
49+
featureEnabled: false,
50+
},
51+
],
52+
trafficAllocation: [
53+
{
54+
entityId: 'holdout_variation_id',
55+
endOfRange: 10000,
56+
},
57+
],
58+
},
59+
];
60+
3461
describe('Optimizely', () => {
3562
const eventDispatcher = {
3663
dispatchEvent: () => Promise.resolve({ statusCode: 200 }),
@@ -217,32 +244,7 @@ describe('Optimizely', () => {
217244
it('should dispatch impression event for holdout decision', async () => {
218245
const datafile = getDecisionTestDatafile();
219246

220-
datafile.holdouts = [
221-
{
222-
id: 'holdout_test_id',
223-
key: 'holdout_test_key',
224-
status: 'Running',
225-
includeFlags: [],
226-
excludeFlags: [],
227-
audienceIds: [],
228-
audienceConditions: [],
229-
variations: [
230-
{
231-
id: 'holdout_variation_id',
232-
key: 'holdout_variation_key',
233-
variables: [],
234-
featureEnabled: false
235-
}
236-
],
237-
trafficAllocation: [
238-
{
239-
entityId: 'holdout_variation_id',
240-
endOfRange: 10000
241-
}
242-
]
243-
}
244-
];
245-
247+
datafile.holdouts = holdoutData;
246248
const projectConfig = createProjectConfig(datafile);
247249

248250
const projectConfigManager = getMockProjectConfigManager({
@@ -307,31 +309,7 @@ describe('Optimizely', () => {
307309
it('should not dispatch impression event for holdout when DISABLE_DECISION_EVENT is used', async () => {
308310
const datafile = getDecisionTestDatafile();
309311

310-
datafile.holdouts = [
311-
{
312-
id: 'holdout_test_id',
313-
key: 'holdout_test_key',
314-
status: 'Running',
315-
includeFlags: [],
316-
excludeFlags: [],
317-
audienceIds: [],
318-
audienceConditions: [],
319-
variations: [
320-
{
321-
id: 'holdout_variation_id',
322-
key: 'holdout_variation_key',
323-
variables: [],
324-
featureEnabled: false
325-
}
326-
],
327-
trafficAllocation: [
328-
{
329-
entityId: 'holdout_variation_id',
330-
endOfRange: 10000
331-
}
332-
]
333-
}
334-
];
312+
datafile.holdouts = holdoutData;
335313

336314
const projectConfig = createProjectConfig(datafile);
337315

@@ -387,31 +365,7 @@ describe('Optimizely', () => {
387365
describe('isFeatureEnabled', () => {
388366
it('should dispatch impression event for holdout decision', async () => {
389367
const datafile = getDecisionTestDatafile();
390-
datafile.holdouts = [
391-
{
392-
id: 'holdout_test_id',
393-
key: 'holdout_test_key',
394-
status: 'Running',
395-
includeFlags: [],
396-
excludeFlags: [],
397-
audienceIds: [],
398-
audienceConditions: [],
399-
variations: [
400-
{
401-
id: 'holdout_variation_id',
402-
key: 'holdout_variation_key',
403-
variables: [],
404-
featureEnabled: false
405-
}
406-
],
407-
trafficAllocation: [
408-
{
409-
entityId: 'holdout_variation_id',
410-
endOfRange: 10000
411-
}
412-
]
413-
}
414-
];
368+
datafile.holdouts = holdoutData;
415369

416370
const projectConfig = createProjectConfig(datafile);
417371
const projectConfigManager = getMockProjectConfigManager({

0 commit comments

Comments
 (0)