Modified experiment unit tests.

This commit is contained in:
Jeremy Zimmerman 2022-11-16 15:56:13 -05:00
parent aed0af2134
commit 1557c76bc5

View file

@ -112,10 +112,12 @@ describe("analyticsMixin.js", () => {
// Assert // Assert
expect(expectedDataLayer).toEqual(expect.arrayContaining(window.dataLayer)); expect(expectedDataLayer).toEqual(expect.arrayContaining(window.dataLayer));
}); });
/*
test("Experiments, should push to dataLayer with default Google Custom Dimension Index", () => { test("Experiments, should push to dataLayer with default Google Custom Dimension Index", () => {
// Arrange // Arrange
window.dataLayer = []; const store = useMainStore();
window.dataLayer = [];
const mockExperimentData = [ const mockExperimentData = [
{ {
@ -125,26 +127,7 @@ describe("analyticsMixin.js", () => {
}, },
]; ];
// Mock store store.applicationUserObj.experiments = mockExperimentData;
jest.mock(
"@/store",
() => {
return {};
},
{ virtual: true }
);
useMainStore.getters = {
applicationUserObj: {
experiments: [
{
settings: {},
variationName: "test",
universeName: "testUniverse",
},
],
},
};
// Act // Act
analyticsMixin.methods.pushExperimentsToDataLayer(mockExperimentData); analyticsMixin.methods.pushExperimentsToDataLayer(mockExperimentData);
@ -163,7 +146,9 @@ describe("analyticsMixin.js", () => {
test("Experiments, should push to dataLayer with custom Google Custom Dimension Index", () => { test("Experiments, should push to dataLayer with custom Google Custom Dimension Index", () => {
// Arrange // Arrange
window.dataLayer = []; const store = useMainStore();
window.dataLayer = [];
const mockExperimentData = [ const mockExperimentData = [
{ {
@ -173,26 +158,7 @@ describe("analyticsMixin.js", () => {
}, },
]; ];
// Mock store store.applicationUserObj.experiments = mockExperimentData;
jest.mock(
"@/store",
() => {
return {};
},
{ virtual: true }
);
useMainStore.getters = {
applicationUserObj: {
experiments: [
{
settings: { "Google Custom Dimension Index": "5" },
variationName: "test",
universeName: "testUniverse",
},
],
},
};
// Act // Act
analyticsMixin.methods.pushExperimentsToDataLayer(mockExperimentData); analyticsMixin.methods.pushExperimentsToDataLayer(mockExperimentData);
@ -208,7 +174,7 @@ describe("analyticsMixin.js", () => {
}, },
]); ]);
}); });
*/
test("Obj is not null after action prepended", () => { test("Obj is not null after action prepended", () => {
//Arrange //Arrange
const obj = { baseMethodName: "testMethodName", data: "testData" }; const obj = { baseMethodName: "testMethodName", data: "testData" };