parent
8cd4231ab5
commit
ec782996df
23 changed files with 678 additions and 181 deletions
|
|
@ -1143,7 +1143,7 @@ describe("buttonQuestion.vue", () => {
|
|||
});
|
||||
|
||||
function setupMocks(mountOptionsMockData = {}) {
|
||||
const defaultMountOptions = { route: { name: "page-name" } };
|
||||
const defaultMountOptions = { route: { query: { fmgPage: "page-name" } } };
|
||||
const baseMountOptions = getMountOptions(
|
||||
Object.assign(defaultMountOptions, mountOptionsMockData)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ import store from "@/store";
|
|||
describe("progressBar", () => {
|
||||
test("progress should be 0", () => {
|
||||
// Arrange
|
||||
mockMixin.computed = {
|
||||
pageName: () => undefined,
|
||||
};
|
||||
|
||||
// Act
|
||||
const wrapper = shallowMount(progressBar, {
|
||||
|
|
@ -15,7 +12,7 @@ describe("progressBar", () => {
|
|||
});
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.getProgress()).toBe(0);
|
||||
expect(wrapper.vm.progress).toBe(0);
|
||||
wrapper.unmount();
|
||||
});
|
||||
});
|
||||
|
|
@ -23,8 +20,10 @@ describe("progressBar", () => {
|
|||
describe("progressBar", () => {
|
||||
test("progress should be 4%", () => {
|
||||
// Arrange
|
||||
mockMixin.computed = {
|
||||
pageName: () => "vehicle",
|
||||
store.getters = {
|
||||
applicationUser: {
|
||||
lastPageVisited: "vehicle",
|
||||
},
|
||||
};
|
||||
|
||||
// Act
|
||||
|
|
@ -33,7 +32,7 @@ describe("progressBar", () => {
|
|||
});
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.getProgress()).toBe(4);
|
||||
expect(wrapper.vm.progress).toBe(4);
|
||||
wrapper.unmount();
|
||||
});
|
||||
});
|
||||
|
|
@ -41,8 +40,10 @@ describe("progressBar", () => {
|
|||
describe("progressBar", () => {
|
||||
test("progress should be 48%", () => {
|
||||
// Arrange
|
||||
mockMixin.computed = {
|
||||
pageName: () => "quote",
|
||||
store.getters = {
|
||||
applicationUser: {
|
||||
lastPageVisited: "quote",
|
||||
},
|
||||
};
|
||||
|
||||
// Act
|
||||
|
|
@ -51,7 +52,7 @@ describe("progressBar", () => {
|
|||
});
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.getProgress()).toBe(48);
|
||||
expect(wrapper.vm.progress).toBe(48);
|
||||
wrapper.unmount();
|
||||
});
|
||||
});
|
||||
|
|
@ -59,8 +60,10 @@ describe("progressBar", () => {
|
|||
describe("progressBar", () => {
|
||||
test("progress should be 100%", () => {
|
||||
// Arrange
|
||||
mockMixin.computed = {
|
||||
pageName: () => "confirmation",
|
||||
store.getters = {
|
||||
applicationUser: {
|
||||
lastPageVisited: "confirmation",
|
||||
},
|
||||
};
|
||||
|
||||
// Act
|
||||
|
|
@ -69,7 +72,7 @@ describe("progressBar", () => {
|
|||
});
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.getProgress()).toBe(100);
|
||||
expect(wrapper.vm.progress).toBe(100);
|
||||
wrapper.unmount();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -245,7 +245,6 @@ function setupMocks() {
|
|||
};
|
||||
const mountOptions = getMountOptions({
|
||||
mixins: [baseMixin, vehicleQuestionsMixin],
|
||||
route: { name: "questions" },
|
||||
});
|
||||
mountOptions["attachTo"] = document.body;
|
||||
const wrapper = shallowMount(questionsPageLayout, mountOptions);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ it("Global Methods - Call Http Client - Should Reject Promise", () => {
|
|||
isError: true,
|
||||
});
|
||||
analyticsMixIn.methods.pushEventToGA = jest.fn();
|
||||
router.bailout = jest.fn();
|
||||
router.navigateError = jest.fn();
|
||||
|
||||
//Act
|
||||
globalMethods.callHttpClient(httpArgs).catch((err) => {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
import * as navigationHelper from "@/helpers/heritage-integration/navigation-helper";
|
||||
import * as orderHelper from "@/helpers/heritage-integration/order-helper";
|
||||
import { lazyLoadComponent } from "@/router/methods/helpers/lazy-load-component";
|
||||
import { lazyLoadComponent } from "@/router/dynamic-routing/component-loader.js";
|
||||
import { storeActions } from "@/constants/store-actions";
|
||||
import { storeMutations } from "@/constants/store-mutations";
|
||||
import { setupMocksForJsFiles, getMockOrderInfo } from "@/helpers/unit-test-helper.js";
|
||||
import { externalUrls } from "@/router/constants/externalUrl-values";
|
||||
import { externalUrls } from "@/router/router-constants/externalUrl-values";
|
||||
import { queryStrings } from "@/constants/query-strings";
|
||||
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
||||
|
||||
import { damageLocationsSelected as glassLocations } from "@/constants/damage-locations-selected";
|
||||
|
||||
|
|
@ -16,10 +17,476 @@ const getPageToRouteExistingOrderTo = navigationHelper.getPageToRouteExistingOrd
|
|||
const navigateToHeritageFunnel = navigationHelper.navigateToHeritageFunnel;
|
||||
|
||||
// Mock Lazy Load
|
||||
jest.mock("@/router/methods/helpers/lazy-load-component", () => ({
|
||||
jest.mock("@/router/dynamic-routing/component-loader.js", () => ({
|
||||
lazyLoadComponent: jest.fn(),
|
||||
}));
|
||||
|
||||
describe("getPageToRouteExistingOrderTo", () => {
|
||||
describe("Explicit vs. Implicit Routing", () => {
|
||||
test("Should call explicit routing if `fmgPage` parameter is present in query", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {
|
||||
fmgPage: "schedule",
|
||||
},
|
||||
};
|
||||
|
||||
mockLazyLoadComponentReturnValues();
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
// Assert
|
||||
// If direct, should be "schedule".
|
||||
// Otherwise, not.
|
||||
expect(result).toBe("schedule");
|
||||
});
|
||||
|
||||
test("Should call implicit routing if `fmgPage` parameter is NOT present in query", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {},
|
||||
};
|
||||
|
||||
mockLazyLoadComponentReturnValues();
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
// Assert
|
||||
// If direct, should be "schedule".
|
||||
// Otherwise, not.
|
||||
expect(result).not.toBe("schedule");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Implicit Routing", () => {
|
||||
test("should return vehicle", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {},
|
||||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
||||
store.commit(storeMutations.UPDATE_MAKE, "acura");
|
||||
|
||||
// Mock out the lazy load calls for all components.
|
||||
mockLazyLoadComponentReturnValues({
|
||||
[fmgPageValues.VEHICLE]: true,
|
||||
[fmgPageValues.VEHICLE_DAMAGE]: false,
|
||||
});
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
//Assert
|
||||
expect(result).toBe(fmgPageValues.VEHICLE);
|
||||
});
|
||||
|
||||
test("should return vehicle-damage", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {},
|
||||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
||||
store.commit(storeMutations.UPDATE_MAKE, "acura");
|
||||
|
||||
// Mock out the lazy load calls for all components.
|
||||
mockLazyLoadComponentReturnValues({
|
||||
[fmgPageValues.VEHICLE]: true,
|
||||
[fmgPageValues.VEHICLE_DAMAGE]: true,
|
||||
[fmgPageValues.ESTIMATE]: false,
|
||||
});
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
//Assert
|
||||
expect(result).toBe(fmgPageValues.VEHICLE_DAMAGE);
|
||||
});
|
||||
|
||||
test("user has YMMS and no vehicle questions > should return estimate", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {},
|
||||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
||||
store.commit(storeMutations.UPDATE_MAKE, "acura");
|
||||
|
||||
const mockExperimentsList = [
|
||||
{
|
||||
universeName: "ConceptFunnel",
|
||||
settings: {
|
||||
SuppressVinCapture: false,
|
||||
},
|
||||
},
|
||||
];
|
||||
store.commit(storeMutations.UPDATE_EXPERIMENTS, mockExperimentsList);
|
||||
|
||||
// Mock out the lazy load calls for all components.
|
||||
mockLazyLoadComponentReturnValues({
|
||||
[fmgPageValues.VEHICLE]: true,
|
||||
[fmgPageValues.VEHICLE_DAMAGE]: true,
|
||||
[fmgPageValues.ESTIMATE]: true,
|
||||
[fmgPageValues.CAPABILITY_QUESTIONS]: false,
|
||||
[fmgPageValues.MOLDING_QUESTIONS]: false,
|
||||
[fmgPageValues.VEHICLE_PARTS]: false,
|
||||
[fmgPageValues.PART_QUESTIONS]: false,
|
||||
[fmgPageValues.VIN_LOOKUP]: true,
|
||||
});
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
//Assert
|
||||
expect(result).toBe(fmgPageValues.ESTIMATE);
|
||||
});
|
||||
|
||||
test("user has YMMS but no questions or carId > should return estimate", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {},
|
||||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
||||
store.commit(storeMutations.UPDATE_MAKE, "acura");
|
||||
|
||||
// Mock out the lazy load calls for all components.
|
||||
mockLazyLoadComponentReturnValues({
|
||||
[fmgPageValues.VEHICLE]: true,
|
||||
[fmgPageValues.VEHICLE_DAMAGE]: true,
|
||||
[fmgPageValues.ESTIMATE]: true,
|
||||
[fmgPageValues.CAPABILITY_QUESTIONS]: false,
|
||||
[fmgPageValues.MOLDING_QUESTIONS]: false,
|
||||
[fmgPageValues.VEHICLE_PARTS]: false,
|
||||
[fmgPageValues.PART_QUESTIONS]: false,
|
||||
[fmgPageValues.VIN_LOOKUP]: false,
|
||||
});
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
//Assert
|
||||
expect(result).toBe(fmgPageValues.ESTIMATE);
|
||||
});
|
||||
|
||||
test("user has capability questions and molding questions > should return capability questions", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {},
|
||||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
||||
store.commit(storeMutations.UPDATE_MAKE, "acura");
|
||||
|
||||
// Mock out the lazy load calls for all components.
|
||||
mockLazyLoadComponentReturnValues({
|
||||
[fmgPageValues.VEHICLE]: true,
|
||||
[fmgPageValues.VEHICLE_DAMAGE]: true,
|
||||
[fmgPageValues.ESTIMATE]: true,
|
||||
[fmgPageValues.CAPABILITY_QUESTIONS]: true,
|
||||
[fmgPageValues.MOLDING_QUESTIONS]: true,
|
||||
[fmgPageValues.VEHICLE_PARTS]: false,
|
||||
[fmgPageValues.PART_QUESTIONS]: false,
|
||||
[fmgPageValues.VIN_LOOKUP]: false,
|
||||
});
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
//Assert
|
||||
expect(result).toBe(fmgPageValues.CAPABILITY_QUESTIONS);
|
||||
});
|
||||
|
||||
test("user has molding questions and part questions > should return molding questions", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {},
|
||||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
||||
store.commit(storeMutations.UPDATE_MAKE, "acura");
|
||||
|
||||
// Mock out the lazy load calls for all components.
|
||||
mockLazyLoadComponentReturnValues({
|
||||
[fmgPageValues.VEHICLE]: true,
|
||||
[fmgPageValues.VEHICLE_DAMAGE]: true,
|
||||
[fmgPageValues.ESTIMATE]: true,
|
||||
[fmgPageValues.CAPABILITY_QUESTIONS]: false,
|
||||
[fmgPageValues.MOLDING_QUESTIONS]: true,
|
||||
[fmgPageValues.VEHICLE_PARTS]: false,
|
||||
[fmgPageValues.PART_QUESTIONS]: true,
|
||||
[fmgPageValues.VIN_LOOKUP]: false,
|
||||
});
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
//Assert
|
||||
expect(result).toBe(fmgPageValues.MOLDING_QUESTIONS);
|
||||
});
|
||||
|
||||
test("user has vehicle parts questions > should return vehicle-parts", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {},
|
||||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
||||
store.commit(storeMutations.UPDATE_MAKE, "acura");
|
||||
|
||||
// Mock out the lazy load calls for all components.
|
||||
mockLazyLoadComponentReturnValues({
|
||||
[fmgPageValues.VEHICLE]: true,
|
||||
[fmgPageValues.VEHICLE_DAMAGE]: true,
|
||||
[fmgPageValues.ESTIMATE]: true,
|
||||
[fmgPageValues.CAPABILITY_QUESTIONS]: false,
|
||||
[fmgPageValues.MOLDING_QUESTIONS]: false,
|
||||
[fmgPageValues.VEHICLE_PARTS]: true,
|
||||
[fmgPageValues.PART_QUESTIONS]: true,
|
||||
[fmgPageValues.VIN_LOOKUP]: false,
|
||||
});
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
//Assert
|
||||
expect(result).toBe(fmgPageValues.VEHICLE_PARTS);
|
||||
});
|
||||
|
||||
test("user has part questions > should return part-questions", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {},
|
||||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
||||
store.commit(storeMutations.UPDATE_MAKE, "acura");
|
||||
|
||||
// Mock out the lazy load calls for all components.
|
||||
mockLazyLoadComponentReturnValues({
|
||||
[fmgPageValues.VEHICLE]: true,
|
||||
[fmgPageValues.VEHICLE_DAMAGE]: true,
|
||||
[fmgPageValues.ESTIMATE]: true,
|
||||
[fmgPageValues.CAPABILITY_QUESTIONS]: false,
|
||||
[fmgPageValues.MOLDING_QUESTIONS]: false,
|
||||
[fmgPageValues.VEHICLE_PARTS]: false,
|
||||
[fmgPageValues.PART_QUESTIONS]: true,
|
||||
[fmgPageValues.VIN_LOOKUP]: false,
|
||||
});
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
//Assert
|
||||
expect(result).toBe(fmgPageValues.PART_QUESTIONS);
|
||||
});
|
||||
|
||||
test("should return quote, if not verified insurance", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {},
|
||||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
||||
store.commit(storeMutations.UPDATE_MAKE, "acura");
|
||||
|
||||
// Mock out the lazy load calls for all components.
|
||||
mockLazyLoadComponentReturnValues({
|
||||
[fmgPageValues.VEHICLE]: true,
|
||||
[fmgPageValues.VEHICLE_DAMAGE]: true,
|
||||
[fmgPageValues.ESTIMATE]: true,
|
||||
[fmgPageValues.CAPABILITY_QUESTIONS]: false,
|
||||
[fmgPageValues.MOLDING_QUESTIONS]: false,
|
||||
[fmgPageValues.VEHICLE_PARTS]: false,
|
||||
[fmgPageValues.PART_QUESTIONS]: true,
|
||||
[fmgPageValues.VIN_LOOKUP]: false,
|
||||
[fmgPageValues.QUOTE]: true,
|
||||
});
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
//Assert
|
||||
expect(result).toBe(fmgPageValues.QUOTE);
|
||||
});
|
||||
|
||||
test("should not return pages beyond quote even if prerequisites are met", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {},
|
||||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
||||
store.commit(storeMutations.UPDATE_MAKE, "acura");
|
||||
|
||||
// Mock out the lazy load calls for all components.
|
||||
mockLazyLoadComponentReturnValues({
|
||||
[fmgPageValues.VEHICLE]: true,
|
||||
[fmgPageValues.VEHICLE_DAMAGE]: true,
|
||||
[fmgPageValues.ESTIMATE]: true,
|
||||
[fmgPageValues.CAPABILITY_QUESTIONS]: false,
|
||||
[fmgPageValues.MOLDING_QUESTIONS]: false,
|
||||
[fmgPageValues.VEHICLE_PARTS]: false,
|
||||
[fmgPageValues.PART_QUESTIONS]: true,
|
||||
[fmgPageValues.VIN_LOOKUP]: false,
|
||||
[fmgPageValues.QUOTE]: true,
|
||||
[fmgPageValues.SERVICE_LOCATION]: true,
|
||||
[fmgPageValues.SCHEDULE]: true,
|
||||
});
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
//Assert
|
||||
expect(result).toBe(fmgPageValues.QUOTE);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Explicit Routing", () => {
|
||||
test("Returns the value passed in in nominal case", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {
|
||||
fmgPage: "testValue",
|
||||
},
|
||||
};
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
// Assert
|
||||
expect(result).toBe("testValue");
|
||||
});
|
||||
|
||||
describe("Verified users", () => {
|
||||
test("Replace navigation to `vehicle` with `vehicle-damage`", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {
|
||||
fmgPage: fmgPageValues.VEHICLE,
|
||||
},
|
||||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
|
||||
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "666666");
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
// Assert
|
||||
expect(result).toBe(fmgPageValues.VEHICLE_DAMAGE);
|
||||
});
|
||||
|
||||
describe("Vin-Exempt", () => {
|
||||
test("Replace navigation to `quote` with `estimate`", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {
|
||||
fmgPage: fmgPageValues.QUOTE,
|
||||
},
|
||||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
|
||||
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "666666");
|
||||
store.commit(storeMutations.UPDATE_IS_REPAIR, true);
|
||||
store.commit(storeMutations.UPDATE_MAKE, "acura");
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
// Assert
|
||||
expect(result).toBe(fmgPageValues.ESTIMATE);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Vin-Required", () => {
|
||||
test("Replace navigation to `quote` with `vin-lookup`", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {
|
||||
fmgPage: fmgPageValues.QUOTE,
|
||||
},
|
||||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
|
||||
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "666666");
|
||||
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
||||
store.commit(storeMutations.UPDATE_MAKE, "acura");
|
||||
store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, [
|
||||
{ glassLocation: glassLocations.WINDSHIELD },
|
||||
]);
|
||||
store.commit(storeMutations.UPDATE_VEHICLE_VIN, "abcd1234");
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
// Assert
|
||||
expect(result).toBe(fmgPageValues.VIN_LOOKUP);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Non-verified users", () => {
|
||||
test("Don't replace navigation to `vehicle` with `vehicle-damage`", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {
|
||||
fmgPage: fmgPageValues.VEHICLE,
|
||||
},
|
||||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, false);
|
||||
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "55555");
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
// Assert
|
||||
expect(result).toBe(fmgPageValues.VEHICLE);
|
||||
});
|
||||
|
||||
test("Don't replace navigation to `quote` with `estimate` or `vin-lookup`", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {
|
||||
fmgPage: fmgPageValues.QUOTE,
|
||||
},
|
||||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, false);
|
||||
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "55555");
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
// Assert
|
||||
expect(result).toBe(fmgPageValues.QUOTE);
|
||||
});
|
||||
|
||||
test("Don't replace navigation to `insurance-company` with `estimate` or `vin-lookup`", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {
|
||||
fmgPage: fmgPageValues.INSURANCE_COMPANY,
|
||||
},
|
||||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, false);
|
||||
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "55555");
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
// Assert
|
||||
expect(result).toBe(fmgPageValues.INSURANCE_COMPANY);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("navigateToHeritageFunnel", () => {
|
||||
test("should save session", async () => {
|
||||
// Arrange
|
||||
|
|
|
|||
|
|
@ -76,9 +76,6 @@ export function getMountOptions(mockData) {
|
|||
mocks: mocks,
|
||||
mixins: mockData.mixins,
|
||||
stubs: { Form },
|
||||
computed: {
|
||||
pageName() { return mockData?.route?.name },
|
||||
},
|
||||
};
|
||||
const props = mockData.propsData || {};
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { shallowMount } from "@vue/test-utils";
|
|||
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||
import { storeActions } from "@/constants/store-actions";
|
||||
import { storeMutations } from "@/constants/store-mutations";
|
||||
import { navigationScenarios } from "@/router/constants/navigation-scenarios";
|
||||
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
||||
import store from "@/store";
|
||||
import { experimentSettings } from "@/constants/experiments";
|
||||
|
||||
|
|
@ -308,9 +308,11 @@ describe("address-lookup.vue", () => {
|
|||
await wrapper.vm.forwardButtonAction();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledWith(
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_VEHICLES,
|
||||
undefined,
|
||||
{},
|
||||
{},
|
||||
carsFound
|
||||
);
|
||||
});
|
||||
|
|
@ -397,7 +399,9 @@ describe("address-lookup.vue", () => {
|
|||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
|
||||
undefined
|
||||
undefined,
|
||||
{},
|
||||
{ displayVehicleChangeAlert: true }
|
||||
);
|
||||
});
|
||||
|
||||
|
|
@ -713,7 +717,6 @@ function setupMocks({
|
|||
navigate: jest.fn(),
|
||||
navigateWithSaving: jest.fn(),
|
||||
navigateWithoutSaving: jest.fn(),
|
||||
navigateWithPageData: jest.fn(),
|
||||
},
|
||||
store: {
|
||||
getters: {
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ describe("estimate.vue", () => {
|
|||
});
|
||||
|
||||
describe("estimate.vue", () => {
|
||||
test.skip("should call forwardButtonAction if isExternalParameter is true and form is valid", async () => {
|
||||
test("should call forwardButtonAction if isExternalParameter is true and form is valid", async () => {
|
||||
store.getters = {
|
||||
externalParameterState: { isExternalParameter: true },
|
||||
externalParameterEstimate: { vinSelection: "decline" },
|
||||
|
|
@ -263,7 +263,7 @@ function setupMocks({
|
|||
navigateWithoutSaving: jest.fn(),
|
||||
},
|
||||
route: {
|
||||
name: "estimate"
|
||||
query: {},
|
||||
},
|
||||
},
|
||||
}) {
|
||||
|
|
@ -271,9 +271,7 @@ function setupMocks({
|
|||
const cmsContent = {
|
||||
groupName: groupName,
|
||||
QuestionText: cmsQuestionText,
|
||||
VinLookupMethod: {
|
||||
Answers: cmsAnswers,
|
||||
},
|
||||
Answers: cmsAnswers,
|
||||
FunnelFooterWidget: FunnelFooterWidget,
|
||||
};
|
||||
const mockMixin = {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ jest.mock("@/mixins/base-mixin.js", () => ({
|
|||
return {
|
||||
navigationScenarios: {
|
||||
CLICKED_BACK: "clicked_back",
|
||||
CLICKED_PAY_ON_MY_OWN: "clicked_pay_on_my_own"
|
||||
},
|
||||
};
|
||||
},
|
||||
|
|
@ -65,7 +64,7 @@ describe("insurance-company.vue", () => {
|
|||
expect(wrapper.vm.isCashParentAccountNumber()).toBe(false);
|
||||
});
|
||||
|
||||
test("should call navigateWithoutSaving with CLICKED_PAY_ON_MY_OWN when forceCashSelection is true", () => {
|
||||
test("should call navigateWithoutSaving with { isCashSelected: true } when forceCashSelection is true", () => {
|
||||
const wrapper = shallowMount(InsuranceCompany, {
|
||||
global: {
|
||||
mocks: {
|
||||
|
|
@ -78,8 +77,9 @@ describe("insurance-company.vue", () => {
|
|||
|
||||
wrapper.vm.backButtonAction(true);
|
||||
expect(mockRouter.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||
wrapper.vm.navigationScenarios.CLICKED_PAY_ON_MY_OWN,
|
||||
wrapper.vm.$route
|
||||
wrapper.vm.navigationScenarios.CLICKED_BACK,
|
||||
wrapper.vm.$route,
|
||||
{ isCashSelected: true }
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -336,7 +336,6 @@ function setupMocks({
|
|||
navigate: jest.fn(),
|
||||
navigateWithSaving: jest.fn(),
|
||||
navigateWithoutSaving: jest.fn(),
|
||||
navigateWithPageData: jest.fn(),
|
||||
},
|
||||
store: {
|
||||
getters: store.getters,
|
||||
|
|
|
|||
|
|
@ -599,13 +599,7 @@ describe("payment.vue", () => {
|
|||
function setupMocks({ customMountOptions }) {
|
||||
const mountOptions = getMountOptions({
|
||||
...customMountOptions,
|
||||
route: { name: "payment-method" },
|
||||
router: {
|
||||
navigateWithSaving: jest.fn(),
|
||||
navigateWithoutSaving: jest.fn(),
|
||||
navigateWithPageData: jest.fn(),
|
||||
navigateAndForceTopLevelNavigation: jest.fn(),
|
||||
},
|
||||
route: { query: { fmgPage: "page-name" }, params: {} },
|
||||
});
|
||||
|
||||
// set all mock stuff
|
||||
|
|
|
|||
|
|
@ -651,7 +651,7 @@ describe("quote.vue", () => {
|
|||
//Assert
|
||||
expect(wrapper.vm.isInsuranceSelected).toBe(false);
|
||||
});
|
||||
test("should default to cash if offer = cash, despite all other checks pointing to insurance selection", async () => {
|
||||
test("should default to cash if isCashSelected is true, despite all other checks pointing to insurance selection", async () => {
|
||||
// Also needs no query parameter or previous selection in store to be present
|
||||
//Arrange
|
||||
|
||||
|
|
@ -695,7 +695,7 @@ describe("quote.vue", () => {
|
|||
//Act
|
||||
await quote.beforeRouteEnter.call(
|
||||
wrapper.vm,
|
||||
{ name: "quote", query: { isInsuranceSelected: true, offer: "cash" } },
|
||||
{ query: { fmgPage: "quote", isInsuranceSelected: true, isCashSelected: true } },
|
||||
undefined,
|
||||
(c) => c(wrapper.vm)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import router from "@/router";
|
|||
import navbar from "@/fmg-components/nav-bar/nav-bar";
|
||||
import { Form } from "vee-validate";
|
||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||
import { navigationScenarios } from "@/router/constants/navigation-scenarios";
|
||||
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||
import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
||||
import { deleteFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
||||
|
|
@ -257,7 +257,7 @@ describe("return-user.vue", () => {
|
|||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithoutSaving).toBeCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD,
|
||||
wrapper.vm.$route.name
|
||||
wrapper.vm.$route
|
||||
);
|
||||
});
|
||||
test("expect functions in startOver to be called", async () => {
|
||||
|
|
@ -272,15 +272,18 @@ describe("return-user.vue", () => {
|
|||
|
||||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithoutSaving).toBeCalledWith(
|
||||
navigationScenarios.CLICKED_RESTART,
|
||||
wrapper.vm.$route.name
|
||||
navigationScenarios.CLICKED_FORWARD,
|
||||
wrapper.vm.$route
|
||||
);
|
||||
|
||||
expect(dispatchStoreActionSpy).toHaveBeenCalledWith(storeActions.RESET_STATE);
|
||||
expect(deleteFunnelCookie).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function setupMocks({ customMountOptions }) {
|
||||
const route = { name: "return-user" };
|
||||
const route = { query: { fmgPage: "return-user" }, params: {} };
|
||||
|
||||
baseMixin.methods.ResetExternalParamsAndHideModal = jest.fn();
|
||||
|
||||
|
|
@ -291,7 +294,6 @@ function setupMocks({ customMountOptions }) {
|
|||
|
||||
mountOptions.global.mocks["$store"] = store;
|
||||
mountOptions.global.mocks["$router"] = router;
|
||||
mountOptions.global.mocks.pageName = route.name;
|
||||
baseMixin.methods.isFormValid = jest.fn().mockReturnValue(true);
|
||||
mountOptions["attachTo"] = document.body;
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ export default {
|
|||
|
||||
async startOver() {
|
||||
this.pushEventToGA(
|
||||
this.pageName,
|
||||
this.$route.query[this.queryStrings.FMG_PAGE],
|
||||
this.GaActions.CLICKED,
|
||||
"Start over",
|
||||
true
|
||||
|
|
|
|||
|
|
@ -463,13 +463,14 @@ describe("schedule.vue...", () => {
|
|||
expect(testOutput4).toBe("3:30 PM");
|
||||
});
|
||||
|
||||
test("Clicking back should fire correct navigation", () => {
|
||||
test("getDisplayTextForMilitaryTime should return the correctly formatted string", () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
wrapper.vm.selectableDatesData = {
|
||||
days: [],
|
||||
};
|
||||
wrapper.vm.$router.navigateWithoutSaving = jest.fn();
|
||||
wrapper.vm.$route = "testRoute";
|
||||
|
||||
// Act
|
||||
wrapper.vm.backButtonAction();
|
||||
|
|
@ -477,7 +478,7 @@ describe("schedule.vue...", () => {
|
|||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithoutSaving).toBeCalledWith(
|
||||
"CLICKED_BACK",
|
||||
"schedule"
|
||||
"testRoute"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
@ -597,7 +598,6 @@ const mockCmsContent = {};
|
|||
function setupMocks({ customMountOptions }) {
|
||||
const mountOptions = getMountOptions({
|
||||
...customMountOptions,
|
||||
route: { name: "schedule" },
|
||||
});
|
||||
|
||||
mountOptions.global.mocks["$store"] = store;
|
||||
|
|
@ -613,7 +613,6 @@ function setupMocks({ customMountOptions }) {
|
|||
},
|
||||
},
|
||||
];
|
||||
mountOptions.global.mocks.pageName = "schedule";
|
||||
|
||||
const wrapper = shallowMount(schedule, mountOptions);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
import serviceZip from "@/layouts/service-zip/service-zip";
|
||||
|
||||
// Supporting Files
|
||||
import { mount, shallowMount } from "@vue/test-utils";
|
||||
import { shallowMount } from "@vue/test-utils";
|
||||
import { getMountOptions } from "@/helpers/unit-test-helper";
|
||||
import baseMixin from "@/mixins/base-mixin";
|
||||
import store from "@/store";
|
||||
import router from "@/router";
|
||||
import { navigationScenarios } from "@/router/constants/navigation-scenarios";
|
||||
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
||||
import { saveSession } from "@/helpers/heritage-integration/order-helper.js";
|
||||
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
||||
import { experimentSettings } from "../../constants/experiments";
|
||||
|
|
@ -251,6 +251,20 @@ describe("service-zip.vue", () => {
|
|||
expect(wrapper.vm.serviceZipCode).toEqual("11111");
|
||||
expect(wrapper.vm.emailOrSms).toEqual("builddigitaltest@safelite.com");
|
||||
});
|
||||
|
||||
test("Zip in querystring -> pushed to data", () => {
|
||||
// Arrange
|
||||
// no changes to store
|
||||
applyMockStoreDataToGetters();
|
||||
|
||||
// Act
|
||||
const wrapper = setupMocks({
|
||||
customZipQuery: "11111",
|
||||
});
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.serviceZipCode).toEqual("11111");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Navigation", () => {
|
||||
|
|
@ -271,7 +285,7 @@ describe("service-zip.vue", () => {
|
|||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithoutSaving).toBeCalledWith(
|
||||
navigationScenarios.CLICKED_BACK_WITH_SKIP_VIN,
|
||||
wrapper.vm.$route.name
|
||||
wrapper.vm.$route
|
||||
);
|
||||
});
|
||||
|
||||
|
|
@ -287,7 +301,7 @@ describe("service-zip.vue", () => {
|
|||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithoutSaving).toBeCalledWith(
|
||||
navigationScenarios.CLICKED_BACK,
|
||||
wrapper.vm.$route.name
|
||||
wrapper.vm.$route
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
@ -312,7 +326,7 @@ describe("service-zip.vue", () => {
|
|||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toBeCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS,
|
||||
wrapper.vm.$route.name
|
||||
wrapper.vm.$route
|
||||
);
|
||||
expect(wrapper.vm.navigateForwardWithSingleCarMatch).not.toBeCalled();
|
||||
});
|
||||
|
|
@ -472,7 +486,7 @@ describe("service-zip.vue", () => {
|
|||
});
|
||||
|
||||
function setupMocks({ customMountOptions, customZipQuery, customZipDataResponse }) {
|
||||
const route = { name: "service-zip" };
|
||||
const route = { query: { fmgPage: "service-zip" }, params: {} };
|
||||
if (customZipQuery) {
|
||||
route.query.zipcode = customZipQuery;
|
||||
}
|
||||
|
|
@ -485,7 +499,6 @@ function setupMocks({ customMountOptions, customZipQuery, customZipDataResponse
|
|||
|
||||
mountOptions.global.mocks["$store"] = store;
|
||||
mountOptions.global.mocks["$router"] = router;
|
||||
mountOptions.global.mocks.pageName = route.name;
|
||||
mountOptions.mixins = [
|
||||
{
|
||||
methods: {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import { storeActions } from "@/constants/store-actions";
|
|||
import store from "@/store";
|
||||
import { validate } from "vee-validate";
|
||||
import { damageLocationsSelected } from "@/constants/damage-locations-selected.js";
|
||||
import { routerParams } from "@/router/router-constants/router-params";
|
||||
import * as cookieHelper from "@/helpers/heritage-integration/cookie-helper";
|
||||
|
||||
// Mock our module for promises.
|
||||
|
|
@ -309,11 +310,11 @@ describe("vehicle-damage.vue", () => {
|
|||
describe("alert", () => {
|
||||
test("when displayVehicleChangeAlert router params is true, the alert: 'vehicleChangeAlert' should be rendered", () => {
|
||||
// Arrange & Act
|
||||
window.history.pushState({ displayVehicleChangeAlert: "true" }, "", "");
|
||||
const { wrapper } = setupMocks({
|
||||
mountOptionsMockData: {
|
||||
route: {
|
||||
name: "vehicle-damage",
|
||||
query: { displayVehicleChangeAlert: true },
|
||||
state: { displayVehicleChangeAlert: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
@ -327,9 +328,8 @@ describe("vehicle-damage.vue", () => {
|
|||
const { wrapper } = setupMocks({
|
||||
mountOptionsMockData: {
|
||||
route: {
|
||||
name: "vehicle-damage",
|
||||
query: {
|
||||
displayVehicleChangeAlert: false,
|
||||
state: {
|
||||
[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -345,9 +345,8 @@ describe("vehicle-damage.vue", () => {
|
|||
const { wrapper } = setupMocks({
|
||||
mountOptionsMockData: {
|
||||
route: {
|
||||
name: "vehicle-damage",
|
||||
query: {
|
||||
displayVehicleChangeAlert: undefined,
|
||||
params: {
|
||||
[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: undefined,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -853,8 +852,9 @@ function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData, funnelCo
|
|||
navigateWithSaving: jest.fn(),
|
||||
},
|
||||
route: {
|
||||
name: "vehicle-damage",
|
||||
query: {},
|
||||
state: {
|
||||
[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false,
|
||||
},
|
||||
},
|
||||
store: {
|
||||
getters: {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import baseMixin from "@/mixins/base-mixin.js";
|
|||
import { storeActions } from "@/constants/store-actions";
|
||||
import store from "@/store";
|
||||
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
||||
import { navigationScenarios } from "@/router/constants/navigation-scenarios";
|
||||
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
||||
|
||||
// Mock our module for promises.
|
||||
jest.mock("@/helpers/layout-helper.js", () => ({
|
||||
|
|
@ -84,10 +84,11 @@ describe("vehicle-parts.vue", () => {
|
|||
navigate: jest.fn(),
|
||||
navigateWithSaving: jest.fn(),
|
||||
navigateWithoutSaving: jest.fn(),
|
||||
navigateWithPageData: jest.fn(),
|
||||
},
|
||||
route: {
|
||||
name: "vehicle-parts",
|
||||
query: {
|
||||
fmgPage: "vehicle-parts",
|
||||
},
|
||||
},
|
||||
store: {
|
||||
getters: store.getters,
|
||||
|
|
@ -122,10 +123,11 @@ describe("vehicle-parts.vue", () => {
|
|||
navigate: jest.fn(),
|
||||
navigateWithSaving: jest.fn(),
|
||||
navigateWithoutSaving: jest.fn(),
|
||||
navigateWithPageData: jest.fn(),
|
||||
},
|
||||
route: {
|
||||
name: "vehicle-parts",
|
||||
query: {
|
||||
fmgPage: "vehicle-parts",
|
||||
},
|
||||
},
|
||||
store: {
|
||||
getters: store.getters,
|
||||
|
|
@ -159,10 +161,11 @@ describe("vehicle-parts.vue", () => {
|
|||
navigate: jest.fn(),
|
||||
navigateWithSaving: jest.fn(),
|
||||
navigateWithoutSaving: jest.fn(),
|
||||
navigateWithPageData: jest.fn(),
|
||||
},
|
||||
route: {
|
||||
name: "vehicle-parts",
|
||||
query: {
|
||||
fmgPage: "vehicle-parts",
|
||||
},
|
||||
},
|
||||
store: {
|
||||
getters: store.getters,
|
||||
|
|
@ -202,10 +205,11 @@ describe("vehicle-parts.vue", () => {
|
|||
navigate: jest.fn(),
|
||||
navigateWithSaving: jest.fn(),
|
||||
navigateWithoutSaving: jest.fn(),
|
||||
navigateWithPageData: jest.fn(),
|
||||
},
|
||||
route: {
|
||||
name: "vehicle-parts",
|
||||
query: {
|
||||
fmgPage: "vehicle-parts",
|
||||
},
|
||||
},
|
||||
store: {
|
||||
getters: {
|
||||
|
|
@ -251,7 +255,7 @@ describe("vehicle-parts.vue", () => {
|
|||
//Assert
|
||||
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
|
||||
wrapper.vm.$route.name
|
||||
wrapper.vm.$route
|
||||
);
|
||||
});
|
||||
|
||||
|
|
@ -264,10 +268,11 @@ describe("vehicle-parts.vue", () => {
|
|||
navigate: jest.fn(),
|
||||
navigateWithSaving: jest.fn(),
|
||||
navigateWithoutSaving: jest.fn(),
|
||||
navigateWithPageData: jest.fn(),
|
||||
},
|
||||
route: {
|
||||
name: "vehicle-parts",
|
||||
query: {
|
||||
fmgPage: "vehicle-parts",
|
||||
},
|
||||
},
|
||||
store: {
|
||||
getters: {
|
||||
|
|
@ -297,7 +302,7 @@ describe("vehicle-parts.vue", () => {
|
|||
//Assert
|
||||
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
|
||||
wrapper.vm.$route.name
|
||||
wrapper.vm.$route
|
||||
);
|
||||
});
|
||||
|
||||
|
|
@ -351,10 +356,11 @@ describe("vehicle-parts.vue", () => {
|
|||
navigate: jest.fn(),
|
||||
navigateWithSaving: jest.fn(),
|
||||
navigateWithoutSaving: jest.fn(),
|
||||
navigateWithPageData: jest.fn(),
|
||||
},
|
||||
route: {
|
||||
name: "vehicle-parts",
|
||||
query: {
|
||||
fmgPage: "vehicle-parts",
|
||||
},
|
||||
},
|
||||
store: {
|
||||
getters: store.getters,
|
||||
|
|
@ -378,7 +384,7 @@ describe("vehicle-parts.vue", () => {
|
|||
await wrapper.vm.forwardButtonAction();
|
||||
|
||||
//Assert
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalled();
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("ForwardButtonAction triggers a router.navigateWithSaving change if there are capability questions", async () => {
|
||||
|
|
@ -411,10 +417,11 @@ describe("vehicle-parts.vue", () => {
|
|||
navigate: jest.fn(),
|
||||
navigateWithSaving: jest.fn(),
|
||||
navigateWithoutSaving: jest.fn(),
|
||||
navigateWithPageData: jest.fn(),
|
||||
},
|
||||
route: {
|
||||
name: "vehicle-parts",
|
||||
query: {
|
||||
fmgPage: "vehicle-parts",
|
||||
},
|
||||
},
|
||||
store: {
|
||||
getters: store.getters,
|
||||
|
|
@ -444,7 +451,7 @@ describe("vehicle-parts.vue", () => {
|
|||
await wrapper.vm.forwardButtonAction();
|
||||
|
||||
//Assert
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalled();
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("ForwardButtonAction saves selected parts to store if no molding or capability questions", async () => {
|
||||
|
|
@ -461,10 +468,11 @@ describe("vehicle-parts.vue", () => {
|
|||
navigate: jest.fn(),
|
||||
navigateWithSaving: jest.fn(),
|
||||
navigateWithoutSaving: jest.fn(),
|
||||
navigateWithPageData: jest.fn(),
|
||||
},
|
||||
route: {
|
||||
name: "vehicle-parts",
|
||||
query: {
|
||||
fmgPage: "vehicle-parts",
|
||||
},
|
||||
},
|
||||
store: {
|
||||
getters: store.getters,
|
||||
|
|
@ -536,7 +544,6 @@ function setupMocks({ pageHeaderWidgetHeaderText = {}, mountOptionsMockData = {}
|
|||
wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent;
|
||||
wrapper.vm.$refs.navbar.removeLoader = jest.fn();
|
||||
wrapper.vm.$refs.loadingModal.showModal = jest.fn();
|
||||
wrapper.vm.pageName = "vehicle-parts";
|
||||
// wrapper.vm.$refs.onSubmit = jest.fn();
|
||||
// wrapper.vm.$refs.onInvalidSubmit = jest.fn();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { shallowMount } from "@vue/test-utils";
|
||||
import vinLookup from "./vin-lookup.vue";
|
||||
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||
import { navigationScenarios } from "@/router/constants/navigation-scenarios.js";
|
||||
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios.js";
|
||||
import { settleAllPromises } from "@/helpers/layout-helper.js";
|
||||
import { experimentSettings } from "@/constants/experiments";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import baseMixin from "@/mixins/base-mixin";
|
||||
import { storeActions } from "@/constants/store-actions.js";
|
||||
import { storeMutations } from "@/constants/store-mutations.js";
|
||||
import { navigationScenarios } from "@/router/constants/navigation-scenarios";
|
||||
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
||||
import { vehicleCategories } from "@/constants/vehicle-categories.js";
|
||||
import { queryStrings } from "@/constants/query-strings";
|
||||
import { dynamicStrings } from "@/constants/dynamic-strings";
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
||||
import { shallowMount } from "@vue/test-utils";
|
||||
import { setupMocksForJsFiles, getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||
import { routeData } from "@/router/constants/routes";
|
||||
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
||||
import { storeMutations } from "@/constants/store-mutations";
|
||||
import store from "@/store";
|
||||
import { storeActions } from "@/constants/store-actions";
|
||||
import { navigationScenarios } from "@/router/constants/navigation-scenarios";
|
||||
import { navigationScenarios } from "../router/router-constants/navigation-scenarios";
|
||||
import { getters } from "@/store";
|
||||
|
||||
jest.mock("@/helpers/heritage-integration/navigation-helper", () => ({
|
||||
|
|
@ -290,13 +290,13 @@ describe("vehicle-questions-mixin", () => {
|
|||
|
||||
describe("currentPageComesBeforePage", () => {
|
||||
const testCases = [
|
||||
[routeData.PART_QUESTIONS, routeData.VEHICLE_PARTS, true],
|
||||
[routeData.VEHICLE_PARTS, routeData.VEHICLE_PARTS, false],
|
||||
[routeData.QUOTE, routeData.VEHICLE_PARTS, false],
|
||||
[routeData.QUOTE, routeData.QUOTE, false],
|
||||
[routeData.VEHICLE_PARTS, routeData.PART_QUESTIONS, false],
|
||||
[routeData.PART_QUESTIONS, routeData.CAPABILITY_QUESTIONS, true],
|
||||
[routeData.MOLDING_QUESTIONS, routeData.CAPABILITY_QUESTIONS, true],
|
||||
[fmgPageValues.PART_QUESTIONS, fmgPageValues.VEHICLE_PARTS, true],
|
||||
[fmgPageValues.VEHICLE_PARTS, fmgPageValues.VEHICLE_PARTS, false],
|
||||
[fmgPageValues.QUOTE, fmgPageValues.VEHICLE_PARTS, false],
|
||||
[fmgPageValues.QUOTE, fmgPageValues.QUOTE, false],
|
||||
[fmgPageValues.VEHICLE_PARTS, fmgPageValues.PART_QUESTIONS, false],
|
||||
[fmgPageValues.PART_QUESTIONS, fmgPageValues.CAPABILITY_QUESTIONS, true],
|
||||
[fmgPageValues.MOLDING_QUESTIONS, fmgPageValues.CAPABILITY_QUESTIONS, true],
|
||||
];
|
||||
test.each(testCases)(
|
||||
"%s comes before %s is %s",
|
||||
|
|
@ -305,7 +305,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
const { wrapper } = setupMocks({});
|
||||
|
||||
// Act
|
||||
const result = wrapper.vm.currentPageComesBeforePage(currentPage.name, nextPage.name);
|
||||
const result = wrapper.vm.currentPageComesBeforePage(currentPage, nextPage);
|
||||
|
||||
// Assert
|
||||
expect(result).toEqual(expectedResult);
|
||||
|
|
@ -315,20 +315,20 @@ describe("vehicle-questions-mixin", () => {
|
|||
|
||||
describe("currentPageComesAfterPage", () => {
|
||||
const testCases = [
|
||||
[routeData.PART_QUESTIONS, routeData.VEHICLE_PARTS, false],
|
||||
[routeData.VEHICLE_PARTS, routeData.VEHICLE_PARTS, false],
|
||||
[routeData.QUOTE, routeData.VEHICLE_PARTS, true],
|
||||
[routeData.QUOTE, routeData.QUOTE, false],
|
||||
[routeData.VEHICLE_PARTS, routeData.PART_QUESTIONS, true],
|
||||
[routeData.PART_QUESTIONS, routeData.CAPABILITY_QUESTIONS, false],
|
||||
[routeData.MOLDING_QUESTIONS, routeData.CAPABILITY_QUESTIONS, false],
|
||||
[fmgPageValues.PART_QUESTIONS, fmgPageValues.VEHICLE_PARTS, false],
|
||||
[fmgPageValues.VEHICLE_PARTS, fmgPageValues.VEHICLE_PARTS, false],
|
||||
[fmgPageValues.QUOTE, fmgPageValues.VEHICLE_PARTS, true],
|
||||
[fmgPageValues.QUOTE, fmgPageValues.QUOTE, false],
|
||||
[fmgPageValues.VEHICLE_PARTS, fmgPageValues.PART_QUESTIONS, true],
|
||||
[fmgPageValues.PART_QUESTIONS, fmgPageValues.CAPABILITY_QUESTIONS, false],
|
||||
[fmgPageValues.MOLDING_QUESTIONS, fmgPageValues.CAPABILITY_QUESTIONS, false],
|
||||
];
|
||||
test.each(testCases)("%s comes after %s is %s", (currentPage, nextPage, expectedResult) => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
|
||||
// Act
|
||||
const result = wrapper.vm.currentPageComesAfterPage(currentPage.name, nextPage.name);
|
||||
const result = wrapper.vm.currentPageComesAfterPage(currentPage, nextPage);
|
||||
|
||||
// Assert
|
||||
expect(result).toEqual(expectedResult);
|
||||
|
|
@ -1321,10 +1321,12 @@ describe("vehicle-questions-mixin", () => {
|
|||
await wrapper.vm.navigateForward(partsOrQuestions);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledWith(
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS,
|
||||
wrapper.vm.$route.name,
|
||||
wrapper.vm.$route,
|
||||
{},
|
||||
{},
|
||||
{ partsOrQuestions }
|
||||
);
|
||||
});
|
||||
|
|
@ -1434,10 +1436,12 @@ describe("vehicle-questions-mixin", () => {
|
|||
await wrapper.vm.navigateForward(partsOrQuestions);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledWith(
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS,
|
||||
wrapper.vm.$route.name,
|
||||
wrapper.vm.$route,
|
||||
{},
|
||||
{},
|
||||
{ partsOrQuestions }
|
||||
);
|
||||
});
|
||||
|
|
@ -1539,10 +1543,12 @@ describe("vehicle-questions-mixin", () => {
|
|||
await wrapper.vm.navigateForward(partsOrQuestions);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledWith(
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS,
|
||||
wrapper.vm.$route.name,
|
||||
wrapper.vm.$route,
|
||||
{},
|
||||
{},
|
||||
{ partsOrQuestions }
|
||||
);
|
||||
});
|
||||
|
|
@ -1692,10 +1698,12 @@ describe("vehicle-questions-mixin", () => {
|
|||
await wrapper.vm.navigateForward(partsOrQuestions);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledWith(
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS,
|
||||
wrapper.vm.$route.name,
|
||||
wrapper.vm.$route,
|
||||
{},
|
||||
{},
|
||||
{ partsOrQuestions }
|
||||
);
|
||||
});
|
||||
|
|
@ -1738,10 +1746,12 @@ describe("vehicle-questions-mixin", () => {
|
|||
await wrapper.vm.navigateForward(partsOrQuestions);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledWith(
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE,
|
||||
wrapper.vm.$route.name,
|
||||
wrapper.vm.$route,
|
||||
{},
|
||||
{},
|
||||
{ partsOrQuestions }
|
||||
);
|
||||
});
|
||||
|
|
@ -1848,10 +1858,12 @@ describe("vehicle-questions-mixin", () => {
|
|||
await wrapper.vm.navigateForward(partsOrQuestions);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledWith(
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE,
|
||||
wrapper.vm.$route.name,
|
||||
wrapper.vm.$route,
|
||||
{},
|
||||
{},
|
||||
{ partsOrQuestions }
|
||||
);
|
||||
});
|
||||
|
|
@ -2024,10 +2036,12 @@ describe("vehicle-questions-mixin", () => {
|
|||
await wrapper.vm.navigateForward(partsOrQuestions);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledWith(
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE,
|
||||
wrapper.vm.$route.name,
|
||||
wrapper.vm.$route,
|
||||
{},
|
||||
{},
|
||||
{ partsOrQuestions }
|
||||
);
|
||||
});
|
||||
|
|
@ -2081,10 +2095,12 @@ describe("vehicle-questions-mixin", () => {
|
|||
await wrapper.vm.navigateForward(partsOrQuestions);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledWith(
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS,
|
||||
wrapper.vm.$route.name,
|
||||
wrapper.vm.$route,
|
||||
{},
|
||||
{},
|
||||
{ partsOrQuestions }
|
||||
);
|
||||
});
|
||||
|
|
@ -2121,10 +2137,12 @@ describe("vehicle-questions-mixin", () => {
|
|||
await wrapper.vm.navigateForward(partsOrQuestions);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithPageData).toHaveBeenCalledWith(
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS,
|
||||
wrapper.vm.$route.name,
|
||||
wrapper.vm.$route,
|
||||
{},
|
||||
{},
|
||||
{ partsOrQuestions }
|
||||
);
|
||||
});
|
||||
|
|
@ -2297,7 +2315,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
|
||||
test("current page is quote, there are no questions, and we have their vin => go to vin-lookup", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({ fmgPage: routeData.QUOTE.name, hasVin: true });
|
||||
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE, hasVin: true });
|
||||
|
||||
// Act
|
||||
store.dispatch = jest.fn(() => {});
|
||||
|
|
@ -2306,13 +2324,13 @@ describe("vehicle-questions-mixin", () => {
|
|||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
|
||||
routeData.QUOTE.name
|
||||
{ query: { fmgPage: fmgPageValues.QUOTE } }
|
||||
);
|
||||
});
|
||||
|
||||
test("current page is quote and there are capability questions => go to capability questions", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({ fmgPage: routeData.QUOTE.name });
|
||||
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE });
|
||||
wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true);
|
||||
|
||||
// Act
|
||||
|
|
@ -2322,13 +2340,13 @@ describe("vehicle-questions-mixin", () => {
|
|||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_BACK_WITH_CAPABILITY_QUESTIONS,
|
||||
routeData.QUOTE.name
|
||||
{ query: { fmgPage: fmgPageValues.QUOTE } }
|
||||
);
|
||||
});
|
||||
|
||||
test("current page is quote and there are part questions and molding questions => go to molding questions", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({ fmgPage: routeData.QUOTE.name });
|
||||
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE });
|
||||
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
|
||||
wrapper.vm.hasChildPartQuestions = jest.fn().mockReturnValue(true);
|
||||
|
||||
|
|
@ -2338,13 +2356,13 @@ describe("vehicle-questions-mixin", () => {
|
|||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_BACK_WITH_MOLDING_QUESTIONS,
|
||||
routeData.QUOTE.name
|
||||
{ query: { fmgPage: fmgPageValues.QUOTE } }
|
||||
);
|
||||
});
|
||||
|
||||
test("current page is molding questions and there are part questions, multiple parts to choose, and capability questions => go to vehicle-parts", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({ fmgPage: routeData.MOLDING_QUESTIONS.name });
|
||||
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.MOLDING_QUESTIONS });
|
||||
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
|
||||
wrapper.vm.hasGlassLocationWithMultipleParts = jest.fn().mockReturnValue(true);
|
||||
wrapper.vm.hasChildPartQuestions = jest.fn().mockReturnValue(true);
|
||||
|
|
@ -2357,13 +2375,13 @@ describe("vehicle-questions-mixin", () => {
|
|||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE,
|
||||
routeData.MOLDING_QUESTIONS.name
|
||||
{ query: { fmgPage: fmgPageValues.MOLDING_QUESTIONS } }
|
||||
);
|
||||
});
|
||||
|
||||
test("current page is molding questions and there are part questions and capability questions => go to part-questions", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({ fmgPage: routeData.MOLDING_QUESTIONS.name });
|
||||
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.MOLDING_QUESTIONS });
|
||||
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
|
||||
wrapper.vm.hasGlassLocationWithMultipleParts = jest.fn().mockReturnValue(false);
|
||||
wrapper.vm.hasChildPartQuestions = jest.fn().mockReturnValue(true);
|
||||
|
|
@ -2376,13 +2394,13 @@ describe("vehicle-questions-mixin", () => {
|
|||
// Assert
|
||||
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
|
||||
routeData.MOLDING_QUESTIONS.name
|
||||
{ query: { fmgPage: fmgPageValues.MOLDING_QUESTIONS } }
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function setupMocks({ fmgPage = routeData.VIN_LOOKUP.name, hasVin, carId }) {
|
||||
function setupMocks({ fmgPage = fmgPageValues.VIN_LOOKUP, hasVin, carId }) {
|
||||
const baseMixin = setupMocksForJsFiles({
|
||||
actionList: [
|
||||
{
|
||||
|
|
@ -2405,7 +2423,6 @@ function setupMocks({ fmgPage = routeData.VIN_LOOKUP.name, hasVin, carId }) {
|
|||
navigate: jest.fn(),
|
||||
navigateWithSaving: jest.fn(),
|
||||
navigateWithoutSaving: jest.fn(),
|
||||
navigateWithPageData: jest.fn(),
|
||||
},
|
||||
store: {
|
||||
commit: jest.fn(),
|
||||
|
|
@ -2419,7 +2436,9 @@ function setupMocks({ fmgPage = routeData.VIN_LOOKUP.name, hasVin, carId }) {
|
|||
},
|
||||
},
|
||||
route: {
|
||||
name: fmgPage
|
||||
query: {
|
||||
fmgPage,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -58,9 +58,6 @@ function setupMocks({ partsOrQuestions = [] }) {
|
|||
},
|
||||
},
|
||||
},
|
||||
route: {
|
||||
name: "vin-lookup",
|
||||
},
|
||||
});
|
||||
|
||||
const mockVinComponent = {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { mutations, state, actions, getters } from "@/store";
|
|||
import { storeMutations } from "@/constants/store-mutations";
|
||||
import { storeActions } from "@/constants/store-actions";
|
||||
import { experimentTriggers } from "@/constants/experiments";
|
||||
import { routeData } from "@/router/constants/routes";
|
||||
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
||||
import { AppointmentTypeStrings } from "@/constants/schedule-constants";
|
||||
|
||||
// Mock global method
|
||||
|
|
@ -1862,15 +1862,15 @@ describe("Actions", () => {
|
|||
null
|
||||
);
|
||||
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, {
|
||||
page: routeData.VEHICLE_PARTS.name,
|
||||
page: fmgPageValues.VEHICLE_PARTS,
|
||||
data: null,
|
||||
});
|
||||
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, {
|
||||
page: routeData.MOLDING_QUESTIONS.name,
|
||||
page: fmgPageValues.MOLDING_QUESTIONS,
|
||||
data: null,
|
||||
});
|
||||
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, {
|
||||
page: routeData.CAPABILITY_QUESTIONS.name,
|
||||
page: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||
data: null,
|
||||
});
|
||||
} else {
|
||||
|
|
@ -1884,15 +1884,15 @@ describe("Actions", () => {
|
|||
null
|
||||
);
|
||||
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, {
|
||||
page: routeData.VEHICLE_PARTS.name,
|
||||
page: fmgPageValues.VEHICLE_PARTS,
|
||||
data: null,
|
||||
});
|
||||
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, {
|
||||
page: routeData.MOLDING_QUESTIONS.name,
|
||||
page: fmgPageValues.MOLDING_QUESTIONS,
|
||||
data: null,
|
||||
});
|
||||
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, {
|
||||
page: routeData.CAPABILITY_QUESTIONS.name,
|
||||
page: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||
data: null,
|
||||
});
|
||||
}
|
||||
|
|
@ -2040,11 +2040,11 @@ describe("Actions", () => {
|
|||
null
|
||||
);
|
||||
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, {
|
||||
page: routeData.MOLDING_QUESTIONS.name,
|
||||
page: fmgPageValues.MOLDING_QUESTIONS,
|
||||
data: null,
|
||||
});
|
||||
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, {
|
||||
page: routeData.CAPABILITY_QUESTIONS.name,
|
||||
page: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||
data: null,
|
||||
});
|
||||
} else {
|
||||
|
|
@ -2058,11 +2058,11 @@ describe("Actions", () => {
|
|||
null
|
||||
);
|
||||
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, {
|
||||
page: routeData.MOLDING_QUESTIONS.name,
|
||||
page: fmgPageValues.MOLDING_QUESTIONS,
|
||||
data: null,
|
||||
});
|
||||
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, {
|
||||
page: routeData.CAPABILITY_QUESTIONS.name,
|
||||
page: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||
data: null,
|
||||
});
|
||||
}
|
||||
|
|
@ -2085,12 +2085,12 @@ describe("Actions", () => {
|
|||
];
|
||||
|
||||
mutations.updatePageData(context, {
|
||||
page: routeData.MOLDING_QUESTIONS.name,
|
||||
page: fmgPageValues.MOLDING_QUESTIONS,
|
||||
data: previouslySelectedParts,
|
||||
});
|
||||
|
||||
mutations.updatePageData(context, {
|
||||
page: routeData.CAPABILITY_QUESTIONS.name,
|
||||
page: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||
data: previouslySelectedParts,
|
||||
});
|
||||
|
||||
|
|
@ -2134,7 +2134,7 @@ describe("Actions", () => {
|
|||
];
|
||||
|
||||
mutations.updatePageData(context, {
|
||||
page: routeData.MOLDING_QUESTIONS.name,
|
||||
page: fmgPageValues.MOLDING_QUESTIONS,
|
||||
data: previouslySelectedParts,
|
||||
});
|
||||
|
||||
|
|
@ -2187,7 +2187,7 @@ describe("Actions", () => {
|
|||
];
|
||||
|
||||
mutations.updatePageData(context, {
|
||||
page: routeData.MOLDING_QUESTIONS.name,
|
||||
page: fmgPageValues.MOLDING_QUESTIONS,
|
||||
data: previouslySelectedParts,
|
||||
});
|
||||
|
||||
|
|
@ -2232,7 +2232,7 @@ describe("Actions", () => {
|
|||
];
|
||||
|
||||
mutations.updatePageData(context, {
|
||||
page: routeData.CAPABILITY_QUESTIONS.name,
|
||||
page: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||
data: previouslySelectedParts,
|
||||
});
|
||||
|
||||
|
|
@ -2285,7 +2285,7 @@ describe("Actions", () => {
|
|||
];
|
||||
|
||||
mutations.updatePageData(context, {
|
||||
page: routeData.CAPABILITY_QUESTIONS.name,
|
||||
page: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||
data: previouslySelectedParts,
|
||||
});
|
||||
|
||||
|
|
@ -2330,7 +2330,7 @@ describe("Actions", () => {
|
|||
];
|
||||
|
||||
mutations.updatePageData(context, {
|
||||
page: routeData.MOLDING_QUESTIONS.name,
|
||||
page: fmgPageValues.MOLDING_QUESTIONS,
|
||||
data: previouslySelectedParts,
|
||||
});
|
||||
|
||||
|
|
@ -2383,7 +2383,7 @@ describe("Actions", () => {
|
|||
];
|
||||
|
||||
mutations.updatePageData(context, {
|
||||
page: routeData.MOLDING_QUESTIONS.name,
|
||||
page: fmgPageValues.MOLDING_QUESTIONS,
|
||||
data: previouslySelectedParts,
|
||||
});
|
||||
|
||||
|
|
@ -2428,7 +2428,7 @@ describe("Actions", () => {
|
|||
];
|
||||
|
||||
mutations.updatePageData(context, {
|
||||
page: routeData.MOLDING_QUESTIONS.name,
|
||||
page: fmgPageValues.MOLDING_QUESTIONS,
|
||||
data: previouslySelectedParts,
|
||||
});
|
||||
|
||||
|
|
@ -2481,7 +2481,7 @@ describe("Actions", () => {
|
|||
];
|
||||
|
||||
mutations.updatePageData(context, {
|
||||
page: routeData.CAPABILITY_QUESTIONS.name,
|
||||
page: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||
data: previouslySelectedParts,
|
||||
});
|
||||
|
||||
|
|
@ -2522,7 +2522,7 @@ describe("Actions", () => {
|
|||
null
|
||||
);
|
||||
expect(context.commit).toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, {
|
||||
page: routeData.CAPABILITY_QUESTIONS.name,
|
||||
page: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||
data: null,
|
||||
});
|
||||
} else {
|
||||
|
|
@ -2532,7 +2532,7 @@ describe("Actions", () => {
|
|||
null
|
||||
);
|
||||
expect(context.commit).not.toBeCalledWith(storeMutations.UPDATE_PAGE_DATA, {
|
||||
page: routeData.CAPABILITY_QUESTIONS.name,
|
||||
page: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||
data: null,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue