CSR-1629
unit test cases
This commit is contained in:
parent
315acd49a7
commit
7f58966fa5
1 changed files with 2 additions and 9 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
import analyticsMixin from "@/mixins/analytics-mixin";
|
import analyticsMixin from "@/mixins/analytics-mixin";
|
||||||
import baseMixin from "@/mixins/base-mixin";
|
import baseMixin from "@/mixins/base-mixin";
|
||||||
import { shallowMount } from "@vue/test-utils";
|
|
||||||
import {
|
import {
|
||||||
setupMocksForJsFiles,
|
setupMocksForJsFiles,
|
||||||
setupCookies,
|
setupCookies,
|
||||||
|
|
@ -854,12 +853,6 @@ describe("analyticsMixin.js", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe("push product array and ecommerce cart to data layer", () => {
|
describe("push product array and ecommerce cart to data layer", () => {
|
||||||
let wrapper;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
wrapper = shallowMount(analyticsMixin);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should push product array to data layer correctly", () => {
|
it("should push product array to data layer correctly", () => {
|
||||||
// Mock the methods
|
// Mock the methods
|
||||||
baseMixin.methods.hasSubmittedOrder = jest.fn();
|
baseMixin.methods.hasSubmittedOrder = jest.fn();
|
||||||
|
|
@ -877,7 +870,7 @@ describe("analyticsMixin.js", () => {
|
||||||
baseMixin.methods.getTotalPriceOfAllLineItemsAndChildParts.mockReturnValue(100);
|
baseMixin.methods.getTotalPriceOfAllLineItemsAndChildParts.mockReturnValue(100);
|
||||||
|
|
||||||
// Call the function
|
// Call the function
|
||||||
wrapper.vm.pushProductArrayToDataLayer();
|
analyticsMixin.methods.pushProductArrayToDataLayer();
|
||||||
|
|
||||||
// Assertions
|
// Assertions
|
||||||
expect(baseMixin.methods.hasSubmittedOrder).toHaveBeenCalled();
|
expect(baseMixin.methods.hasSubmittedOrder).toHaveBeenCalled();
|
||||||
|
|
@ -904,7 +897,7 @@ describe("analyticsMixin.js", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Call the function
|
// Call the function
|
||||||
wrapper.vm.pushECommerceCartToDataLayer();
|
analyticsMixin.methods.pushECommerceCartToDataLayer();
|
||||||
|
|
||||||
// Assertions
|
// Assertions
|
||||||
expect(baseMixin.methods.hasSubmittedOrder).toHaveBeenCalled();
|
expect(baseMixin.methods.hasSubmittedOrder).toHaveBeenCalled();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue