diff --git a/src/layouts/contact-details/contact-details.spec.js b/src/layouts/contact-details/contact-details.spec.js index 9ee0dec4..7930b319 100644 --- a/src/layouts/contact-details/contact-details.spec.js +++ b/src/layouts/contact-details/contact-details.spec.js @@ -248,13 +248,25 @@ describe('contactDetails.vue', () => { expect(wrapper.vm.$router.navigateWithSpinner) .toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK, undefined); }); - test('Forward button clicked triggers navigation', () => { + test('Forward button clicked triggers appropriate navigation when safelite shop', () => { // Arrange - const wrapper = shallowMount(contactDetails, getMountOptions({ + const mountOptions = getMountOptions({ router: { navigate: jest.fn() + }, + navigationScenarios + }); + const mainInitialState = { + order: { + serviceLocation: { IsSafeliteProvider: true } } - })); + }; + mountOptions.global.plugins = [createTestingPinia({ + initialState: { + main: mainInitialState + } + })]; + const wrapper = shallowMount(contactDetails, mountOptions); // Act wrapper.vm.forwardButtonAction(); @@ -262,7 +274,35 @@ describe('contactDetails.vue', () => { // Assert expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); expect(wrapper.vm.$router.navigate) - .toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD, undefined); + .toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE_SHOP, undefined); + }); + test('Forward button clicked triggers appropriate navigation when TPA shop', () => { + // Arrange + const mountOptions = getMountOptions({ + router: { + navigate: jest.fn() + }, + navigationScenarios + }); + const mainInitialState = { + order: { + serviceLocation: { IsSafeliteProvider: false } + } + }; + mountOptions.global.plugins = [createTestingPinia({ + initialState: { + main: mainInitialState + } + })]; + const wrapper = shallowMount(contactDetails, mountOptions); + + // Act + wrapper.vm.forwardButtonAction(); + + // Assert + expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); + expect(wrapper.vm.$router.navigate) + .toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_NON_SAFELITE_SHOP, undefined); }); test('Forward button click updates contact info', () => { // Arrange