route to carrier URL
This commit is contained in:
parent
cb246a9055
commit
2a043a077e
3 changed files with 29 additions and 12 deletions
|
|
@ -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', () => {
|
||||
|
|
@ -352,11 +368,12 @@ describe('TPAConfirmation.vue', () => {
|
|||
});
|
||||
});
|
||||
describe('Navigation', () => {
|
||||
test.only('Forward button action, navigate forward with CLICKED_FORWARD scenario', () => {
|
||||
test('If Advanced flow, forward button action navigates to carrier URL', () => {
|
||||
// Arrange
|
||||
const carrierReturnUrl = 'testURL';
|
||||
const initialStore = {
|
||||
issConfig: {
|
||||
successReturnURL: 'testURL'
|
||||
successReturnURL: carrierReturnUrl
|
||||
}
|
||||
};
|
||||
const { wrapper } = getMountedComponent(initialStore);
|
||||
|
|
@ -365,8 +382,7 @@ describe('TPAConfirmation.vue', () => {
|
|||
wrapper.vm.forwardButtonAction();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.navigateForward)
|
||||
.toHaveBeenCalled();
|
||||
expect(wrapper.vm.$router.navigateToExternalUrl).toHaveBeenCalledWith(carrierReturnUrl);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -180,10 +180,7 @@ export default {
|
|||
methods:
|
||||
{
|
||||
async forwardButtonAction() {
|
||||
this.navigateForward();
|
||||
},
|
||||
navigateForward() {
|
||||
window.location.href = this.carrierUrl;
|
||||
this.$router.navigateToExternalUrl(this.carrierUrl);
|
||||
},
|
||||
getCustomValueFromString(str) {
|
||||
switch (str) {
|
||||
|
|
|
|||
|
|
@ -182,6 +182,10 @@ router.navigateWithoutSaving = (
|
|||
navigate(scenario, currentRoute, optionalQuery, optionalParams, optionalPageData);
|
||||
};
|
||||
|
||||
router.navigateToExternalUrl = (url, optionalQuery = {}) => {
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue