Fixed unit tests for changed functionality.
This commit is contained in:
parent
d42a8b4af2
commit
e86085e9d3
2 changed files with 2 additions and 104 deletions
|
|
@ -175,7 +175,7 @@ describe("getPageToRouteExistingOrderTo", () => {
|
||||||
expect(result).toBe('vehicle-damage');
|
expect(result).toBe('vehicle-damage');
|
||||||
});
|
});
|
||||||
|
|
||||||
test("getPageToRouteExistingOrderTo, should return license-plate-lookup", async () => {
|
test("getPageToRouteExistingOrderTo, should return vin-lookup", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const toRoute = {
|
const toRoute = {
|
||||||
query: {}
|
query: {}
|
||||||
|
|
@ -228,7 +228,7 @@ describe("getPageToRouteExistingOrderTo", () => {
|
||||||
const result = await getPageToRouteExistingOrderTo(toRoute, false);
|
const result = await getPageToRouteExistingOrderTo(toRoute, false);
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(result).toBe('license-plate-lookup');
|
expect(result).toBe('vin-lookup');
|
||||||
});
|
});
|
||||||
|
|
||||||
test("getPageToRouteExistingOrderTo, should return estimate", async () => {
|
test("getPageToRouteExistingOrderTo, should return estimate", async () => {
|
||||||
|
|
|
||||||
|
|
@ -182,66 +182,6 @@ describe("vehicle-damage.vue", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("vehicle-damage.vue", () => {
|
|
||||||
test("Windshield replace with single part on ForwardButtonAction triggers a router.navigate and saves selections to store", async () => {
|
|
||||||
//Arrange
|
|
||||||
const partsData = { partsOrQuestions: [
|
|
||||||
{
|
|
||||||
glassLocation: "Windshield",
|
|
||||||
glassName: "Single",
|
|
||||||
partQuestions: null,
|
|
||||||
parts: [
|
|
||||||
{
|
|
||||||
color: "Green Tint, Green Shade",
|
|
||||||
description: "rain sensor, solar",
|
|
||||||
partNumber: "FW02728GGYN",
|
|
||||||
requiresCapabilityQuestions: false,
|
|
||||||
requiresRecalibration: false
|
|
||||||
}
|
|
||||||
]}]};
|
|
||||||
|
|
||||||
const { wrapper } = setupMocks({
|
|
||||||
pageHeaderWidgetHeaderText: "",
|
|
||||||
mountOptionsMockData: {
|
|
||||||
router: { navigate: jest.fn(), },
|
|
||||||
actionList: [{ actionName: storeActions.GET_PARTS_OR_QUESTIONS, data: partsData, },],
|
|
||||||
store: {
|
|
||||||
getters: {
|
|
||||||
vehicle: {},
|
|
||||||
payment: { insuranceCoverage: { isVerified: false } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
wrapper.vm.selectedDamageLocations = ["Windshield"];
|
|
||||||
wrapper.vm.selectedWindshieldOptions = {
|
|
||||||
selectedWindshieldChipCount : null,
|
|
||||||
selectedWindshieldReplaceOptions : ["Single"],
|
|
||||||
selectedWindshieldDamageType: ["Replace"]
|
|
||||||
};
|
|
||||||
|
|
||||||
const expectedGlassToReplace = [{location: "Windshield", name: "Single"},];
|
|
||||||
|
|
||||||
//Act
|
|
||||||
vehicleDamage.beforeRouteEnter.call(
|
|
||||||
wrapper.vm,
|
|
||||||
{ query: { fmgPage: "vehicle-damage" } },
|
|
||||||
undefined,
|
|
||||||
(c) => c(wrapper.vm)
|
|
||||||
);
|
|
||||||
|
|
||||||
await wrapper.vm.forwardButtonAction();
|
|
||||||
|
|
||||||
//Assert
|
|
||||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
|
|
||||||
expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace);
|
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_IS_REPAIR, false);
|
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_GLASS_TO_REPLACE, expectedGlassToReplace);
|
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_PARTS, partsData.partsOrQuestions[0].parts);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("vehicle-damage.vue", () => {
|
describe("vehicle-damage.vue", () => {
|
||||||
test("Windshield replace with multiple parts on ForwardButtonAction triggers a router.navigateAfterSave and saves selections to store", async () => {
|
test("Windshield replace with multiple parts on ForwardButtonAction triggers a router.navigateAfterSave and saves selections to store", async () => {
|
||||||
//Arrange
|
//Arrange
|
||||||
|
|
@ -332,48 +272,6 @@ describe("vehicle-damage.vue", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe("vehicle-damage.vue", () => {
|
|
||||||
test("Windshield repair on ForwardButtonAction triggers a router.navigate and saves selection to store", async () => {
|
|
||||||
//Arrange
|
|
||||||
const partsData = { partsOrQuestions: []};
|
|
||||||
const { wrapper } = setupMocks({
|
|
||||||
pageHeaderWidgetHeaderText: "",
|
|
||||||
mountOptionsMockData: {
|
|
||||||
router: { navigate: jest.fn(), },
|
|
||||||
actionList: [{ actionName: storeActions.GET_PARTS_OR_QUESTIONS, data: partsData, },],
|
|
||||||
store: {
|
|
||||||
getters: {
|
|
||||||
vehicle: {},
|
|
||||||
payment: { insuranceCoverage: { isVerified: false } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
wrapper.vm.selectedDamageLocations = ["Windshield"];
|
|
||||||
wrapper.vm.selectedWindshieldOptions = {
|
|
||||||
selectedWindshieldChipCount : [2],
|
|
||||||
selectedWindshieldDamageType: ["Repair"]
|
|
||||||
};
|
|
||||||
|
|
||||||
//Act
|
|
||||||
vehicleDamage.beforeRouteEnter.call(
|
|
||||||
wrapper.vm,
|
|
||||||
{ query: { fmgPage: "vehicle-damage" } },
|
|
||||||
undefined,
|
|
||||||
(c) => c(wrapper.vm)
|
|
||||||
);
|
|
||||||
|
|
||||||
await wrapper.vm.forwardButtonAction();
|
|
||||||
|
|
||||||
//Assert
|
|
||||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
|
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_IS_REPAIR, true);
|
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_NUMBER_OF_CHIPS, 2);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("vehicle-damage.vue", () => {
|
describe("vehicle-damage.vue", () => {
|
||||||
test("isWindshieldDamageLocation is true when windshield is selected", async () => {
|
test("isWindshieldDamageLocation is true when windshield is selected", async () => {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue