Skip to content

Commit

Permalink
Fix localhost mode tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilianoSanchez committed Dec 11, 2024
1 parent f4c2de6 commit c046061
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/__tests__/offline/browser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ tape('Browser offline mode', function (assert) {

// Manager tests
const expectedSplitView1 = {
name: 'testing_split', trafficType: 'localhost', killed: false, changeNumber: 0, treatments: ['on'], configs: {}, defaultTreatment: 'control', sets: []
name: 'testing_split', trafficType: 'localhost', killed: false, changeNumber: 0, treatments: ['on'], configs: {}, defaultTreatment: 'control', sets: [], trackImpressions: true
};
const expectedSplitView2 = {
name: 'testing_split_with_config', trafficType: 'localhost', killed: false, changeNumber: 0, treatments: ['off'], configs: { off: '{ "color": "blue" }' }, defaultTreatment: 'control', sets: []
name: 'testing_split_with_config', trafficType: 'localhost', killed: false, changeNumber: 0, treatments: ['off'], configs: { off: '{ "color": "blue" }' }, defaultTreatment: 'control', sets: [], trackImpressions: true
};
assert.deepEqual(manager.names(), ['testing_split', 'testing_split_with_config']);
assert.deepEqual(manager.split('testing_split'), expectedSplitView1);
Expand Down Expand Up @@ -282,7 +282,7 @@ tape('Browser offline mode', function (assert) {

// Manager tests
const expectedSplitView3 = {
name: 'testing_split_with_config', trafficType: 'localhost', killed: false, changeNumber: 0, treatments: ['nope'], configs: {}, defaultTreatment: 'control', sets: []
name: 'testing_split_with_config', trafficType: 'localhost', killed: false, changeNumber: 0, treatments: ['nope'], configs: {}, defaultTreatment: 'control', sets: [], trackImpressions: true
};
assert.deepEqual(manager.names(), ['testing_split', 'testing_split_2', 'testing_split_3', 'testing_split_with_config']);
assert.deepEqual(manager.split('testing_split'), expectedSplitView1);
Expand Down
24 changes: 14 additions & 10 deletions src/__tests__/offline/node.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,17 +250,17 @@ function ManagerDotSplitTests(assert) {
const expectedView1 = {
name: 'testing_split', changeNumber: 0, killed: false, trafficType: 'localhost',
treatments: ['on'], configs: {}, defaultTreatment: 'control',
sets: []
sets: [], trackImpressions: true
};
const expectedView2 = {
name: 'testing_split2', changeNumber: 0, killed: false, trafficType: 'localhost',
treatments: ['off'], configs: {}, defaultTreatment: 'control',
sets: []
sets: [], trackImpressions: true
};
const expectedView3 = {
name: 'testing_split3', changeNumber: 0, killed: false, trafficType: 'localhost',
treatments: ['custom_treatment'], configs: {}, defaultTreatment: 'control',
sets: []
sets: [], trackImpressions: true
};

assert.deepEqual(manager.split('testing_split'), expectedView1);
Expand Down Expand Up @@ -294,7 +294,8 @@ function ManagerDotYamlTests(mockFileName, assert) {
treatments: ['on'],
configs: {},
sets: [],
defaultTreatment: 'control'
defaultTreatment: 'control',
trackImpressions: true
};
const expectedView2 = {
name: 'testing_split_only_wl',
Expand All @@ -304,7 +305,8 @@ function ManagerDotYamlTests(mockFileName, assert) {
treatments: ['whitelisted'],
configs: {},
sets: [],
defaultTreatment: 'control'
defaultTreatment: 'control',
trackImpressions: true
};
const expectedView3 = {
name: 'testing_split_with_wl',
Expand All @@ -317,7 +319,8 @@ function ManagerDotYamlTests(mockFileName, assert) {
multi_key_wl: '{"color": "brown"}'
},
sets: [],
defaultTreatment: 'control'
defaultTreatment: 'control',
trackImpressions: true
};
const expectedView4 = {
name: 'testing_split_off_with_config',
Expand All @@ -329,7 +332,8 @@ function ManagerDotYamlTests(mockFileName, assert) {
off: '{"color": "green"}'
},
sets: [],
defaultTreatment: 'control'
defaultTreatment: 'control',
trackImpressions: true
};

assert.deepEqual(manager.split('testing_split_on'), expectedView1);
Expand Down Expand Up @@ -410,15 +414,15 @@ function MultipleInstancesTests(assert) {

const expectedView1 = {
name: 'testing_split', changeNumber: 0, killed: false, trafficType: 'localhost',
treatments: ['on'], configs: {}, sets: []
treatments: ['on'], configs: {}, sets: [], trackImpressions: true
};
const expectedView2 = {
name: 'testing_split2', changeNumber: 0, killed: false, trafficType: 'localhost',
treatments: ['off'], configs: {}, sets: []
treatments: ['off'], configs: {}, sets: [], trackImpressions: true
};
const expectedView3 = {
name: 'testing_split3', changeNumber: 0, killed: false, trafficType: 'localhost',
treatments: ['custom_treatment'], configs: {}, sets: []
treatments: ['custom_treatment'], configs: {}, sets: [], trackImpressions: true
};

assert.deepEqual(manager.split('testing_split'), expectedView1);
Expand Down

0 comments on commit c046061

Please sign in to comment.