diff --git a/src/constants/application-config.js b/src/constants/application-config.js index 4c5305783..808acfe0a 100644 --- a/src/constants/application-config.js +++ b/src/constants/application-config.js @@ -10,6 +10,7 @@ const applicationConfig = { PAGE_QUERYSTRING: "fmgPage", SITE_ENTRY_TRIGGER_VALUE: "FixMyGlass", CASH_PARENT_ACCOUNT_NUMBER: 167132, + MY_ACCOUNT: process.env.VUE_APP_MY_ACCOUNT, }; export { applicationConfig }; diff --git a/src/layouts/confirmation/confirmation.spec.js b/src/layouts/confirmation/confirmation.spec.js index 1f71aa033..41795d660 100644 --- a/src/layouts/confirmation/confirmation.spec.js +++ b/src/layouts/confirmation/confirmation.spec.js @@ -6,6 +6,7 @@ import { shallowMount } from "@vue/test-utils"; import { nextTick } from "vue"; import { getMountOptions } from "@/helpers/unit-test-helper.js"; import store from "@/store"; +import router from "@/router"; // Mock our module for promises. jest.mock("@/helpers/layout-helper.js", () => ({ @@ -54,6 +55,11 @@ beforeEach(() => { isRepair: false, }, referralNumber: "1234567", + vehicle: { + year: "2004", + make: "Ford", + model: "F Series F250", + }, }, payment: { isInsurance: true, @@ -71,9 +77,19 @@ afterEach(() => { }); describe("confirmation.vue", () => { + const realLocation = window.location; + + beforeAll(() => { + delete window.location; + window.location = { ...realLocation, assign: jest.fn() }; + }); + + afterAll(() => { + window.location = realLocation; + }); test("arePagePrerequisitesValid should be true ", async () => { //Arrange - const { wrapper } = setupMocks(); + const { wrapper } = setupMocks({}); //Act let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid(); @@ -82,20 +98,33 @@ describe("confirmation.vue", () => { //Assert expect(arePagePrerequisitesValid).toBe(true); }); + test("'Back to safelite.com' button should take user back to safelite.com", async () => { + //Arrange + const { wrapper } = setupMocks({}); + + //Act + await wrapper.vm.forwardButtonAction(); + + //Assert + expect(window.location.assign).toHaveBeenCalled(); + }); }); -function setupMocks() { - const wrapper = shallowMount( - confirmation, - getMountOptions({ - router: { - navigate: jest.fn(), - navigate: jest.fn(), - navigateWithSaving: jest.fn(), - navigateWithoutSaving: jest.fn(), - }, - }) - ); +const wordingText = "wording Text"; +function setupMocks({ customMountOptions }) { + const mountOptions = getMountOptions({ + ...customMountOptions, + }); + mountOptions.mixins = [ + { + methods: { + getCmsContent: jest.fn().mockImplementation(() => { + return wordingText; + }), + }, + }, + ]; + const wrapper = shallowMount(confirmation, mountOptions); return { wrapper }; } diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue index 726a222df..bdb40dd30 100644 --- a/src/layouts/confirmation/confirmation.vue +++ b/src/layouts/confirmation/confirmation.vue @@ -36,7 +36,7 @@
- +