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 { mount } from '@vue/test-utils';
|
||||||
import { createTestingPinia } from '@pinia/testing';
|
import { createTestingPinia } from '@pinia/testing';
|
||||||
import bailoutMessage from '@/constants/bailoutMessage';
|
import bailoutMessage from '@/constants/bailoutMessage';
|
||||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios.js';
|
|
||||||
|
|
||||||
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
||||||
|
|
||||||
|
|
@ -40,7 +39,8 @@ const footerStub = {
|
||||||
function getMountedComponent(mainInitialState = {}, initialData = {}, methodToRun = () => {}) {
|
function getMountedComponent(mainInitialState = {}, initialData = {}, methodToRun = () => {}) {
|
||||||
const mountOptions = getMountOptions({
|
const mountOptions = getMountOptions({
|
||||||
router: {
|
router: {
|
||||||
navigate: jest.fn()
|
navigate: jest.fn(),
|
||||||
|
navigateToExternalUrl: jest.fn()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -154,9 +154,15 @@ describe('TPAConfirmation.vue', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(deductibleBox.exists()).toBe(true);
|
expect(deductibleBox.exists()).toBe(true);
|
||||||
});
|
});
|
||||||
test('Should render Site Footer', () => {
|
test('If Advanced flow, should display Site Footer', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = getMountedComponent({});
|
const carrierReturnUrl = 'testURL';
|
||||||
|
const initialStore = {
|
||||||
|
issConfig: {
|
||||||
|
successReturnURL: carrierReturnUrl
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const { wrapper } = getMountedComponent(initialStore);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const siteFooter = wrapper.findComponent({ ref: 'siteFooter' });
|
const siteFooter = wrapper.findComponent({ ref: 'siteFooter' });
|
||||||
|
|
@ -164,6 +170,16 @@ describe('TPAConfirmation.vue', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(siteFooter.exists()).toBe(true);
|
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('Computed properties', () => {
|
||||||
describe('Deductible Box value', () => {
|
describe('Deductible Box value', () => {
|
||||||
|
|
@ -352,11 +368,12 @@ describe('TPAConfirmation.vue', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('Navigation', () => {
|
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
|
// Arrange
|
||||||
|
const carrierReturnUrl = 'testURL';
|
||||||
const initialStore = {
|
const initialStore = {
|
||||||
issConfig: {
|
issConfig: {
|
||||||
successReturnURL: 'testURL'
|
successReturnURL: carrierReturnUrl
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const { wrapper } = getMountedComponent(initialStore);
|
const { wrapper } = getMountedComponent(initialStore);
|
||||||
|
|
@ -365,8 +382,7 @@ describe('TPAConfirmation.vue', () => {
|
||||||
wrapper.vm.forwardButtonAction();
|
wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.navigateForward)
|
expect(wrapper.vm.$router.navigateToExternalUrl).toHaveBeenCalledWith(carrierReturnUrl);
|
||||||
.toHaveBeenCalled();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -180,10 +180,7 @@ export default {
|
||||||
methods:
|
methods:
|
||||||
{
|
{
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
this.navigateForward();
|
this.$router.navigateToExternalUrl(this.carrierUrl);
|
||||||
},
|
|
||||||
navigateForward() {
|
|
||||||
window.location.href = this.carrierUrl;
|
|
||||||
},
|
},
|
||||||
getCustomValueFromString(str) {
|
getCustomValueFromString(str) {
|
||||||
switch (str) {
|
switch (str) {
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,10 @@ router.navigateWithoutSaving = (
|
||||||
navigate(scenario, currentRoute, optionalQuery, optionalParams, optionalPageData);
|
navigate(scenario, currentRoute, optionalQuery, optionalParams, optionalPageData);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
router.navigateToExternalUrl = (url, optionalQuery = {}) => {
|
||||||
|
navigateToUrl(url, optionalQuery);
|
||||||
|
};
|
||||||
|
|
||||||
// Get route information by page name.
|
// 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.
|
// This will reach out to the Cms and there is a 1:1 relationship between page names and route names.
|
||||||
async function GetRouteInfoFromPageName(pageName) {
|
async function GetRouteInfoFromPageName(pageName) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue