unit test for vinNotFound alert
This commit is contained in:
parent
f6dea71133
commit
fa77f6775a
1 changed files with 28 additions and 22 deletions
|
|
@ -49,28 +49,30 @@ describe("license-plate-lookup.vue", () => {
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
// test("If no vehicles found, display VinNotFound alert", async () => {
|
test("If no vehicles found, display VinNotFound alert", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
// const mockRegistrationLicensePlate = {
|
const mockRegistrationLicensePlate = {
|
||||||
// licensePlate: "",
|
licensePlate: "TEST1234",
|
||||||
// };
|
};
|
||||||
|
|
||||||
// const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({
|
||||||
|
vinLookupResponseError: "vin not found error"
|
||||||
|
});
|
||||||
|
|
||||||
// useMainStore().order.vehicle.carId = "TESTCARID";
|
useMainStore().order.vehicle.carId = "TESTCARID";
|
||||||
|
|
||||||
// await wrapper.setData({
|
await wrapper.setData({
|
||||||
// licensePlate: mockRegistrationLicensePlate
|
licensePlate: mockRegistrationLicensePlate
|
||||||
// });
|
});
|
||||||
|
|
||||||
// wrapper.vm.navigateForward = jest.fn();
|
wrapper.vm.navigateForward = jest.fn();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
// await wrapper.vm.forwardButtonAction();
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
// expect(wrapper.findComponent({ ref: "alertVinNotFound" }).isVisible()).toBe(true);
|
expect(wrapper.findComponent({ ref: "alertVinNotFound" }).isVisible()).toBe(true);
|
||||||
// });
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
describe ("navigation", () => {
|
describe ("navigation", () => {
|
||||||
|
|
@ -200,10 +202,10 @@ function setupMocks({
|
||||||
lookupVinByPlateResponse,
|
lookupVinByPlateResponse,
|
||||||
partsOrQuestions = [],
|
partsOrQuestions = [],
|
||||||
vehicle = {},
|
vehicle = {},
|
||||||
|
vin = null,
|
||||||
carId = "C0000",
|
carId = "C0000",
|
||||||
|
vinLookupResponseError = null,
|
||||||
route = null,
|
route = null,
|
||||||
licensePlate = "TEST123",
|
|
||||||
licenseState = "ZZ",
|
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
useMainStore().validateZip = jest.fn().mockImplementation(() => {
|
useMainStore().validateZip = jest.fn().mockImplementation(() => {
|
||||||
|
|
@ -219,8 +221,10 @@ function setupMocks({
|
||||||
return Promise.resolve({
|
return Promise.resolve({
|
||||||
data: lookupVinByPlateResponse
|
data: lookupVinByPlateResponse
|
||||||
? lookupVinByPlateResponse: {
|
? lookupVinByPlateResponse: {
|
||||||
licensePlate: licensePlate,
|
vin: "TEST_VIN",
|
||||||
licenseState: licenseState,
|
vehicle: {
|
||||||
|
carId: "CARID"
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
@ -261,9 +265,9 @@ function setupMocks({
|
||||||
isServiceable: isZipServiceable,
|
isServiceable: isZipServiceable,
|
||||||
},
|
},
|
||||||
vinLookupResponse: {
|
vinLookupResponse: {
|
||||||
|
vin: vin,
|
||||||
vehicle: vehicle,
|
vehicle: vehicle,
|
||||||
licensePlate: licensePlate,
|
error: vinLookupResponseError,
|
||||||
licenseState: licenseState,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -273,6 +277,8 @@ function setupMocks({
|
||||||
wrapper.vm.setCmsContent = jest.fn();
|
wrapper.vm.setCmsContent = jest.fn();
|
||||||
wrapper.vm.$refs.siteFooter.updateButtonText = jest.fn();
|
wrapper.vm.$refs.siteFooter.updateButtonText = jest.fn();
|
||||||
wrapper.vm.$refs.siteFooter.removeLoader = jest.fn();
|
wrapper.vm.$refs.siteFooter.removeLoader = jest.fn();
|
||||||
|
wrapper.vm.$refs.siteFooter.disableForwardButton = jest.fn();
|
||||||
|
wrapper.vm.$refs.siteFooter.enableForwardButton = jest.fn();
|
||||||
|
|
||||||
return { wrapper };
|
return { wrapper };
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue