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
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" };