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