unit test cases
This commit is contained in:
hiteshkumar87 2024-09-19 19:31:31 +05:30
parent 315acd49a7
commit 7f58966fa5

View file

@ -1,6 +1,5 @@
import analyticsMixin from "@/mixins/analytics-mixin";
import baseMixin from "@/mixins/base-mixin";
import { shallowMount } from "@vue/test-utils";
import {
setupMocksForJsFiles,
setupCookies,
@ -854,12 +853,6 @@ describe("analyticsMixin.js", () => {
});
});
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", () => {
// Mock the methods
baseMixin.methods.hasSubmittedOrder = jest.fn();
@ -877,7 +870,7 @@ describe("analyticsMixin.js", () => {
baseMixin.methods.getTotalPriceOfAllLineItemsAndChildParts.mockReturnValue(100);
// Call the function
wrapper.vm.pushProductArrayToDataLayer();
analyticsMixin.methods.pushProductArrayToDataLayer();
// Assertions
expect(baseMixin.methods.hasSubmittedOrder).toHaveBeenCalled();
@ -904,7 +897,7 @@ describe("analyticsMixin.js", () => {
});
// Call the function
wrapper.vm.pushECommerceCartToDataLayer();
analyticsMixin.methods.pushECommerceCartToDataLayer();
// Assertions
expect(baseMixin.methods.hasSubmittedOrder).toHaveBeenCalled();