diff --git a/src/layouts/review/customer-details-modal-question/customer-details-modal-question.spec.js b/src/layouts/review/customer-details-modal-question/customer-details-modal-question.spec.js deleted file mode 100644 index abd264cef..000000000 --- a/src/layouts/review/customer-details-modal-question/customer-details-modal-question.spec.js +++ /dev/null @@ -1,150 +0,0 @@ -import { shallowMount } from "@vue/test-utils"; -import { getMountOptions } from "@/helpers/unit-test-helper.js"; - -import customerDetailsModalQuestion from "@/layouts/review/customer-details-modal-question/customer-details-modal-question"; - -const testConstants = { - previousCustomerValues: { - firstName: "First", - lastName: "Last", - emailAddress: "builddigitaltest@safelite.com", - phoneNumber: "111-111-1111", - isSmsOptIn: false, - }, - newValues: { - firstName: "New First", - lastName: "New Last", - emailAddress: "builddigitaltest2@safelite.com", - phoneNumber: "222-222-2222", - isSmsOptIn: true, - }, -}; - -let cmsContent; - -describe("Customer Details Modal", () => { - beforeEach(() => { - cmsContent = {}; - }); - - describe("Submit", () => { - test("Should push to store if a field has changed", async () => { - // Arrange - let props = generateDefaultProps(); - - const { wrapper } = setupMocks({ - propsData: props, - }); - - // Act - wrapper.vm.onModalOpened(); - - wrapper.vm.firstName = testConstants.newValues.firstName; - - await wrapper.vm.setContactDetails(); - await wrapper.vm.$nextTick(); - - // Assert - expect(wrapper.vm.dispatchStoreAction).toHaveBeenCalled(); - expect(wrapper.vm.closeModal).toHaveBeenCalled(); - }); - - test("Should not push to store if no fields have changed", async () => { - // Arrange - let props = generateDefaultProps(); - - const { wrapper } = setupMocks({ - propsData: props, - }); - - // Act - wrapper.vm.onModalOpened(); - - await wrapper.vm.setContactDetails(); - await wrapper.vm.$nextTick(); - - // Assert - expect(wrapper.vm.dispatchStoreAction).not.toHaveBeenCalled(); - expect(wrapper.vm.closeModal).toHaveBeenCalled(); - }); - }); - - describe("Default values", () => { - test("Should populate on open", () => { - // Arrange - let props = generateDefaultProps(); - - const { wrapper } = setupMocks({ - propsData: props, - }); - - // Act - wrapper.vm.onModalOpened(); - - // Assert - expect(wrapper.vm.firstName).toBe(testConstants.previousCustomerValues.firstName); - expect(wrapper.vm.lastName).toBe(testConstants.previousCustomerValues.lastName); - expect(wrapper.vm.emailAddress).toBe(testConstants.previousCustomerValues.emailAddress); - expect(wrapper.vm.phoneNumber).toBe(testConstants.previousCustomerValues.phoneNumber); - expect(wrapper.vm.isSmsOptIn).toBe(testConstants.previousCustomerValues.isSmsOptIn); - }); - - test("Should replace old values on open", async () => { - // Arrange - let props = generateDefaultProps(); - - const { wrapper } = setupMocks({ - propsData: props, - }); - - // Act - wrapper.vm.firstName = testConstants.newValues.firstName; - wrapper.vm.lastName = testConstants.newValues.lastName; - wrapper.vm.emailAddress = testConstants.newValues.emailAddress; - wrapper.vm.phoneNumber = testConstants.newValues.phoneNumber; - wrapper.vm.isSmsOptIn = testConstants.newValues.isSmsOptIn; - - wrapper.vm.onModalOpened(); - - // Assert - expect(wrapper.vm.firstName).toBe(testConstants.previousCustomerValues.firstName); - expect(wrapper.vm.lastName).toBe(testConstants.previousCustomerValues.lastName); - expect(wrapper.vm.emailAddress).toBe(testConstants.previousCustomerValues.emailAddress); - expect(wrapper.vm.phoneNumber).toBe(testConstants.previousCustomerValues.phoneNumber); - expect(wrapper.vm.isSmsOptIn).toBe(testConstants.previousCustomerValues.isSmsOptIn); - }); - }); -}); - -function generateDefaultProps() { - return { - previousCustomerValues: { - firstName: testConstants.previousCustomerValues.firstName, - lastName: testConstants.previousCustomerValues.lastName, - emailAddress: testConstants.previousCustomerValues.emailAddress, - phoneNumber: testConstants.previousCustomerValues.phoneNumber, - isSmsOptIn: testConstants.previousCustomerValues.isSmsOptIn, - }, - }; -} - -function setupMocks(customMountOptions) { - const mountOptions = getMountOptions(customMountOptions); - - const mockMixin = { - methods: { - getCmsContent: jest.fn((widgetName, cmsFieldName) => { - return cmsContent?.[widgetName]?.[cmsFieldName] ?? ""; - }), - }, - }; - - mountOptions.global.mixins = [mockMixin]; - - const wrapper = shallowMount(customerDetailsModalQuestion, mountOptions); - wrapper.vm.setCmsContent = jest.fn(); - wrapper.vm.openModal = jest.fn(); - wrapper.vm.closeModal = jest.fn(); - wrapper.vm.dispatchStoreAction = jest.fn(); - return { wrapper }; -} diff --git a/src/layouts/review/customer-details-modal-question/customer-details-modal-question.vue b/src/layouts/review/customer-details-modal-question/customer-details-modal-question.vue deleted file mode 100644 index 0b08abee7..000000000 --- a/src/layouts/review/customer-details-modal-question/customer-details-modal-question.vue +++ /dev/null @@ -1,148 +0,0 @@ - - - diff --git a/src/layouts/review/review.vue b/src/layouts/review/review.vue index 0c9fa1533..be0af585e 100644 --- a/src/layouts/review/review.vue +++ b/src/layouts/review/review.vue @@ -89,10 +89,6 @@
- - diff --git a/src/router/router-constants/navigation-scenarios.js b/src/router/router-constants/navigation-scenarios.js index ce2f32134..10339a6a0 100644 --- a/src/router/router-constants/navigation-scenarios.js +++ b/src/router/router-constants/navigation-scenarios.js @@ -52,6 +52,7 @@ const navigationScenarios = { CLICKED_SERVICE_PACKAGE_EDIT: "CLICKED_SERVICE_PACKAGE_EDIT", CLICKED_SERVICE_LOCATION_EDIT: "CLICKED_SERVICE_LOCATION_EDIT", CLICKED_SCHEDULE_EDIT: "CLICKED_SCHEDULE_EDIT", + CLICKED_CUSTOMER_EDIT: "CLICKED_CUSTOMER_EDIT", }; export { navigationScenarios }; diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index f1f83b445..953eaffc3 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -488,6 +488,10 @@ const routingTable = function (store) { scenario: navigationScenarios.CLICKED_SCHEDULE_EDIT, destinationFmgPageValue: fmgPageValues.SCHEDULE, }, + { + scenario: navigationScenarios.CLICKED_CUSTOMER_EDIT, + destinationFmgPageValue: fmgPageValues.CUSTOMER_DETAILS, + }, ], }, ];