Modified experiment unit tests.
This commit is contained in:
parent
aed0af2134
commit
1557c76bc5
1 changed files with 10 additions and 44 deletions
|
|
@ -112,10 +112,12 @@ describe("analyticsMixin.js", () => {
|
|||
// Assert
|
||||
expect(expectedDataLayer).toEqual(expect.arrayContaining(window.dataLayer));
|
||||
});
|
||||
/*
|
||||
|
||||
test("Experiments, should push to dataLayer with default Google Custom Dimension Index", () => {
|
||||
// Arrange
|
||||
window.dataLayer = [];
|
||||
const store = useMainStore();
|
||||
|
||||
window.dataLayer = [];
|
||||
|
||||
const mockExperimentData = [
|
||||
{
|
||||
|
|
@ -125,26 +127,7 @@ describe("analyticsMixin.js", () => {
|
|||
},
|
||||
];
|
||||
|
||||
// Mock store
|
||||
jest.mock(
|
||||
"@/store",
|
||||
() => {
|
||||
return {};
|
||||
},
|
||||
{ virtual: true }
|
||||
);
|
||||
|
||||
useMainStore.getters = {
|
||||
applicationUserObj: {
|
||||
experiments: [
|
||||
{
|
||||
settings: {},
|
||||
variationName: "test",
|
||||
universeName: "testUniverse",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
store.applicationUserObj.experiments = mockExperimentData;
|
||||
|
||||
// Act
|
||||
analyticsMixin.methods.pushExperimentsToDataLayer(mockExperimentData);
|
||||
|
|
@ -163,7 +146,9 @@ describe("analyticsMixin.js", () => {
|
|||
|
||||
test("Experiments, should push to dataLayer with custom Google Custom Dimension Index", () => {
|
||||
// Arrange
|
||||
window.dataLayer = [];
|
||||
const store = useMainStore();
|
||||
|
||||
window.dataLayer = [];
|
||||
|
||||
const mockExperimentData = [
|
||||
{
|
||||
|
|
@ -173,26 +158,7 @@ describe("analyticsMixin.js", () => {
|
|||
},
|
||||
];
|
||||
|
||||
// Mock store
|
||||
jest.mock(
|
||||
"@/store",
|
||||
() => {
|
||||
return {};
|
||||
},
|
||||
{ virtual: true }
|
||||
);
|
||||
|
||||
useMainStore.getters = {
|
||||
applicationUserObj: {
|
||||
experiments: [
|
||||
{
|
||||
settings: { "Google Custom Dimension Index": "5" },
|
||||
variationName: "test",
|
||||
universeName: "testUniverse",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
store.applicationUserObj.experiments = mockExperimentData;
|
||||
|
||||
// Act
|
||||
analyticsMixin.methods.pushExperimentsToDataLayer(mockExperimentData);
|
||||
|
|
@ -208,7 +174,7 @@ describe("analyticsMixin.js", () => {
|
|||
},
|
||||
]);
|
||||
});
|
||||
*/
|
||||
|
||||
test("Obj is not null after action prepended", () => {
|
||||
//Arrange
|
||||
const obj = { baseMethodName: "testMethodName", data: "testData" };
|
||||
|
|
|
|||
Loading…
Reference in a new issue