added test and missed requirement for navigation to bailout page
This commit is contained in:
parent
a0c3228021
commit
eb5b39d1fd
9 changed files with 188 additions and 17 deletions
|
|
@ -2,7 +2,7 @@ import { mount } from "@vue/test-utils"
|
|||
import providerPrefRadio from "./provider-pref-radio"
|
||||
import inputButtonWrapperMixin from "@/mixins/input-button-wrapper-mixin"
|
||||
|
||||
describe.skip("provider-pref-radio.vue", () => {
|
||||
describe("provider-pref-radio.vue", () => {
|
||||
it("Should include buttonLabel in html", async () => {
|
||||
// Arrange
|
||||
let { wrapper } = setupMocks({
|
||||
|
|
|
|||
|
|
@ -47,6 +47,47 @@ describe('provider-preference.vue', () => {
|
|||
expect(wrapper.vm.showSteeringLink).toBeFalsy();
|
||||
|
||||
});
|
||||
|
||||
test("Should navigate to safelite flow when safelite selected", () =>
|
||||
{
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks();
|
||||
|
||||
// Act
|
||||
wrapper.vm.selectedProvider = "SafeliteOption";
|
||||
wrapper.vm.forwardButtonAction();
|
||||
|
||||
// Test
|
||||
expect(wrapper.vm.$router.navigate).toBeCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE, "provider-preference");
|
||||
});
|
||||
|
||||
test("Should navigate to tpa flow when TPAOption selected and TPA Flow Enabled", () =>
|
||||
{
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks();
|
||||
|
||||
// Act
|
||||
wrapper.vm.selectedProvider = "TPAOption";
|
||||
useMainStore().issConfig.enableTPAFlow = true;
|
||||
wrapper.vm.forwardButtonAction();
|
||||
|
||||
// Test
|
||||
expect(wrapper.vm.$router.navigate).toBeCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_TPA_ENABLED, "provider-preference");
|
||||
});
|
||||
|
||||
test("Should navigate to tpa disabled route page when TPAOption selected and TPA Flow disabled", () =>
|
||||
{
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks();
|
||||
|
||||
// Act
|
||||
wrapper.vm.selectedProvider = "TPAOption";
|
||||
useMainStore().issConfig.enableTPAFlow = false;
|
||||
wrapper.vm.forwardButtonAction();
|
||||
|
||||
// Test
|
||||
expect(wrapper.vm.$router.navigate).toBeCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_TPA_DISABLED, "provider-preference");
|
||||
});
|
||||
});
|
||||
|
||||
function setupMocks(mockApiResponses){
|
||||
|
|
@ -55,6 +96,7 @@ function setupMocks(mockApiResponses){
|
|||
router: {
|
||||
navigate: jest.fn(),
|
||||
},
|
||||
route: "provider-preference"
|
||||
});
|
||||
|
||||
const wrapper = shallowMount(
|
||||
|
|
@ -64,9 +106,7 @@ function setupMocks(mockApiResponses){
|
|||
|
||||
useMainStore().getCoveragePolicyInfo = jest.fn().mockImplementation(() => {
|
||||
return Promise.resolve({
|
||||
data: {
|
||||
policies:policies,
|
||||
},
|
||||
data: {},
|
||||
})
|
||||
})
|
||||
|
||||
|
|
@ -75,6 +115,5 @@ function setupMocks(mockApiResponses){
|
|||
settleAllPromises.mockImplementation(() => apiResponses);
|
||||
fetchCmsContentForPage.mockImplementation (() => {});
|
||||
|
||||
|
||||
return { wrapper };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,23 +147,28 @@ export default {
|
|||
},
|
||||
forwardButtonAction() {
|
||||
if(this.selectedProvider) {
|
||||
let scenario = null;
|
||||
switch (this.selectedProvider) {
|
||||
case options.SAFELITE:
|
||||
this.navigateForward(this.navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE);
|
||||
scenario = this.navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE;
|
||||
break;
|
||||
case options.TPA:
|
||||
if(this.mainStore.hasRecalibrationPart)
|
||||
if(this.mainStore.issConfig.enableTPAFlow)
|
||||
{
|
||||
//open tpa adas modal here, else save selection and navigate forward
|
||||
console.log('add tpa modal code');
|
||||
return;
|
||||
if(this.mainStore.hasRecalibrationPart)
|
||||
{
|
||||
//open tpa adas modal here, else save selection and navigate forward
|
||||
console.log('add tpa modal code');
|
||||
return;
|
||||
}
|
||||
scenario = this.navigationScenarios.CLICKED_FORWARD_WITH_TPA_ENABLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.navigateForward(this.navigationScenarios.CLICKED_FORWARD_WITH_TPA);
|
||||
else{
|
||||
scenario = this.navigationScenarios.CLICKED_FORWARD_WITH_TPA_DISABLED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
this.navigateForward(scenario);
|
||||
this.mainStore.saveProviderPreferenceData({selectedProvider: this.selectedProvider, tpaAcknowledgement: this.tpaAcknowledgement});
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
import shopPreferenceModal from "./shop-preference-modal.vue"
|
||||
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
import { settleAllPromises } from "@/helpers/layout-helper.js";
|
||||
import { fetchCmsContentForPage, setupModalLinks } from "@/helpers/cms-content-helper";
|
||||
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||
import { useMainStore } from "@/store";
|
||||
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
||||
import { nextTick } from "vue";
|
||||
|
||||
// Mock our module for promises.
|
||||
jest.mock("@/helpers/layout-helper.js", () => ({
|
||||
settleAllPromises: jest.fn(),
|
||||
}));
|
||||
|
||||
// Mock fetchCmsContentForPage
|
||||
jest.mock("@/helpers/cms-content-helper", () => ({
|
||||
fetchCmsContentForPage: jest.fn(),
|
||||
setupModalLinks: jest.fn(),
|
||||
}));
|
||||
|
||||
describe('provider-preference.vue', () => {
|
||||
test("Should display state specific steering modal link when in state with steering language", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({showSteeringLink: true});
|
||||
|
||||
// Act
|
||||
|
||||
// Test
|
||||
expect(wrapper.vm.showSteeringLink).toBeTruthy();
|
||||
|
||||
});
|
||||
|
||||
test("Should not display state specific steering modal link when not in state with steering language", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({showSteeringLink: false});
|
||||
|
||||
// Act
|
||||
|
||||
// Test
|
||||
expect(wrapper.vm.showSteeringLink).toBeFalsy();
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
function setupMocks(propsData){
|
||||
const mountOptions = getMountOptions({
|
||||
router: {
|
||||
navigate: jest.fn(),
|
||||
},
|
||||
});
|
||||
|
||||
mountOptions.propsData = propsData;
|
||||
|
||||
const wrapper = shallowMount(
|
||||
shopPreferenceModal,
|
||||
mountOptions
|
||||
);
|
||||
|
||||
|
||||
const apiResponses = {};
|
||||
|
||||
settleAllPromises.mockImplementation(() => apiResponses);
|
||||
fetchCmsContentForPage.mockImplementation (() => {});
|
||||
|
||||
|
||||
return { wrapper };
|
||||
}
|
||||
|
|
@ -56,7 +56,6 @@ export default {
|
|||
openModal() {
|
||||
this.$refs[this.ModalName].openModal();
|
||||
},
|
||||
|
||||
footerButtonClick() {
|
||||
this.$refs[this.ModalName].closeModal();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
import steeringModal from "./steering-modal.vue"
|
||||
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
import { settleAllPromises } from "@/helpers/layout-helper.js";
|
||||
import { fetchCmsContentForPage, setupModalLinks } from "@/helpers/cms-content-helper";
|
||||
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||
import { useMainStore } from "@/store";
|
||||
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
||||
import { nextTick } from "vue";
|
||||
|
||||
// Mock our module for promises.
|
||||
jest.mock("@/helpers/layout-helper.js", () => ({
|
||||
settleAllPromises: jest.fn(),
|
||||
}));
|
||||
|
||||
// Mock fetchCmsContentForPage
|
||||
jest.mock("@/helpers/cms-content-helper", () => ({
|
||||
fetchCmsContentForPage: jest.fn(),
|
||||
setupModalLinks: jest.fn(),
|
||||
}));
|
||||
|
||||
describe('steering-modal.vue', () => {
|
||||
test('getStateSpecificText should return true if state matches', () => {
|
||||
const { wrapper } = setupMocks();
|
||||
|
||||
useMainStore().order.customer.address.state = "OH";
|
||||
expect(wrapper.vm.getStateSpecificText("OH")).toBeTruthy();
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
function setupMocks(){
|
||||
|
||||
const mountOptions = getMountOptions({
|
||||
router: {
|
||||
navigate: jest.fn(),
|
||||
},
|
||||
});
|
||||
|
||||
const wrapper = shallowMount(
|
||||
steeringModal,
|
||||
mountOptions
|
||||
);
|
||||
|
||||
const apiResponses = {};
|
||||
|
||||
settleAllPromises.mockImplementation(() => apiResponses);
|
||||
fetchCmsContentForPage.mockImplementation (() => {});
|
||||
|
||||
|
||||
return { wrapper };
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ export const issPageValues = {
|
|||
|
||||
ADDRESS_LOOKUP: 'address-lookup',
|
||||
ADDRESS_VEHICLES: 'address-vehicles',
|
||||
BAILOUT_PAGE: 'bailout-page',
|
||||
CAPABILITY_QUESTIONS: 'capability-questions',
|
||||
CONTACT_DETAILS: 'contact-details',
|
||||
ESTIMATE: 'estimate',
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ const navigationScenarios = {
|
|||
|
||||
//Provider Preference
|
||||
CLICKED_FORWARD_WITH_SAFELITE: "CLICKED_FORWARD_WITH_SAFELITE",
|
||||
CLICKED_FORWARD_WITH_TPA: "CLICKED_FORWARD_WITH_TPA"
|
||||
CLICKED_FORWARD_WITH_TPA_ENABLED: "CLICKED_FORWARD_WITH_TPA_ENABLED",
|
||||
CLICKED_FORWARD_WITH_TPA_DISABLED: "CLICKED_FORWARD_WITH_TPA_DISABLED"
|
||||
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -442,8 +442,12 @@ const routingTable = function(store) {
|
|||
destinationIssPageValue: issPageValues.SERVICE_LOCATION
|
||||
},
|
||||
{
|
||||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_TPA,
|
||||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_TPA_ENABLED,
|
||||
destinationIssPageValue: issPageValues.TPA_SEARCH
|
||||
},
|
||||
{
|
||||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_TPA_DISABLED,
|
||||
destinationIssPageValue: issPageValues.BAILOUT_PAGE
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue