diff --git a/src/layouts/tpa-confirmation/tpa-confirmation.spec.js b/src/layouts/tpa-confirmation/tpa-confirmation.spec.js index 04e0af2a..20792266 100644 --- a/src/layouts/tpa-confirmation/tpa-confirmation.spec.js +++ b/src/layouts/tpa-confirmation/tpa-confirmation.spec.js @@ -9,7 +9,6 @@ import { fetchCmsContentForPage } from '@/helpers/cms-content-helper'; import { mount } from '@vue/test-utils'; import { createTestingPinia } from '@pinia/testing'; import bailoutMessage from '@/constants/bailoutMessage'; -// import navigationScenarios from '@/router/router-constants/navigation-scenarios.js'; jest.mock('@/helpers/layout-helper.js', () => jest.fn()); @@ -40,7 +39,8 @@ const footerStub = { function getMountedComponent(mainInitialState = {}, initialData = {}, methodToRun = () => {}) { const mountOptions = getMountOptions({ router: { - navigate: jest.fn() + navigate: jest.fn(), + navigateToExternalUrl: jest.fn() } }); @@ -154,9 +154,15 @@ describe('TPAConfirmation.vue', () => { // Assert expect(deductibleBox.exists()).toBe(true); }); - test('Should render Site Footer', () => { + test('If Advanced flow, should display Site Footer', () => { // Arrange - const { wrapper } = getMountedComponent({}); + const carrierReturnUrl = 'testURL'; + const initialStore = { + issConfig: { + successReturnURL: carrierReturnUrl + } + }; + const { wrapper } = getMountedComponent(initialStore); // Act const siteFooter = wrapper.findComponent({ ref: 'siteFooter' }); @@ -164,6 +170,16 @@ describe('TPAConfirmation.vue', () => { // Assert expect(siteFooter.exists()).toBe(true); }); + test('If Essential flow, should not display Site Footer', () => { + // Arrange + const { wrapper } = getMountedComponent(); + + // Act + const siteFooter = wrapper.findComponent({ ref: 'siteFooter' }); + + // Assert + expect(siteFooter.isVisible()).toBe(false); + }); }); describe('Computed properties', () => { describe('Deductible Box value', () => { @@ -351,19 +367,23 @@ describe('TPAConfirmation.vue', () => { ); }); }); - // TODO: Add tests for forward navigation to carrier URL - card SSR-1107 describe('Navigation', () => { - // test('Forward button action, navigate forward with CLICKED_FORWARD scenario', () => { - // // Arrange - // const { wrapper } = getMountedComponent({}); + test('If Advanced flow, forward button action navigates to carrier URL', () => { + // Arrange + const carrierReturnUrl = 'testURL'; + const initialStore = { + issConfig: { + successReturnURL: carrierReturnUrl + } + }; + const { wrapper } = getMountedComponent(initialStore); - // // Act - // wrapper.vm.forwardButtonAction(); + // Act + wrapper.vm.forwardButtonAction(); - // // Assert - // expect(wrapper.vm.$router.navigate) - // .toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD); - // }); + // Assert + expect(wrapper.vm.$router.navigateToExternalUrl).toHaveBeenCalledWith(carrierReturnUrl); + }); }); }); }); diff --git a/src/layouts/tpa-confirmation/tpa-confirmation.vue b/src/layouts/tpa-confirmation/tpa-confirmation.vue index 24460ba0..3741f4b8 100644 --- a/src/layouts/tpa-confirmation/tpa-confirmation.vue +++ b/src/layouts/tpa-confirmation/tpa-confirmation.vue @@ -54,6 +54,7 @@ :value="deductibleBoxValue" /> { + navigateToUrl(url, optionalQuery); +}; + // Get route information by page name. // This will reach out to the Cms and there is a 1:1 relationship between page names and route names. async function GetRouteInfoFromPageName(pageName) {