diff --git a/src/mixins/analytics-mixin.spec.js b/src/mixins/analytics-mixin.spec.js index 42f33d88..2f2faeac 100644 --- a/src/mixins/analytics-mixin.spec.js +++ b/src/mixins/analytics-mixin.spec.js @@ -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" };