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
|
||||
);
|
||||
});
|
||||
// test("If no vehicles found, display VinNotFound alert", async () => {
|
||||
// Arrange
|
||||
// const mockRegistrationLicensePlate = {
|
||||
// licensePlate: "",
|
||||
// };
|
||||
test("If no vehicles found, display VinNotFound alert", async () => {
|
||||
// Arrange
|
||||
const mockRegistrationLicensePlate = {
|
||||
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({
|
||||
// licensePlate: mockRegistrationLicensePlate
|
||||
// });
|
||||
await wrapper.setData({
|
||||
licensePlate: mockRegistrationLicensePlate
|
||||
});
|
||||
|
||||
// wrapper.vm.navigateForward = jest.fn();
|
||||
wrapper.vm.navigateForward = jest.fn();
|
||||
|
||||
// Act
|
||||
// await wrapper.vm.forwardButtonAction();
|
||||
// Act
|
||||
await wrapper.vm.forwardButtonAction();
|
||||
|
||||
// Assert
|
||||
// expect(wrapper.findComponent({ ref: "alertVinNotFound" }).isVisible()).toBe(true);
|
||||
// });
|
||||
// Assert
|
||||
expect(wrapper.findComponent({ ref: "alertVinNotFound" }).isVisible()).toBe(true);
|
||||
});
|
||||
|
||||
});
|
||||
describe ("navigation", () => {
|
||||
|
|
@ -200,10 +202,10 @@ function setupMocks({
|
|||
lookupVinByPlateResponse,
|
||||
partsOrQuestions = [],
|
||||
vehicle = {},
|
||||
vin = null,
|
||||
carId = "C0000",
|
||||
vinLookupResponseError = null,
|
||||
route = null,
|
||||
licensePlate = "TEST123",
|
||||
licenseState = "ZZ",
|
||||
})
|
||||
{
|
||||
useMainStore().validateZip = jest.fn().mockImplementation(() => {
|
||||
|
|
@ -219,8 +221,10 @@ function setupMocks({
|
|||
return Promise.resolve({
|
||||
data: lookupVinByPlateResponse
|
||||
? lookupVinByPlateResponse: {
|
||||
licensePlate: licensePlate,
|
||||
licenseState: licenseState,
|
||||
vin: "TEST_VIN",
|
||||
vehicle: {
|
||||
carId: "CARID"
|
||||
},
|
||||
},
|
||||
})
|
||||
});
|
||||
|
|
@ -261,9 +265,9 @@ function setupMocks({
|
|||
isServiceable: isZipServiceable,
|
||||
},
|
||||
vinLookupResponse: {
|
||||
vin: vin,
|
||||
vehicle: vehicle,
|
||||
licensePlate: licensePlate,
|
||||
licenseState: licenseState,
|
||||
error: vinLookupResponseError,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -273,6 +277,8 @@ function setupMocks({
|
|||
wrapper.vm.setCmsContent = jest.fn();
|
||||
wrapper.vm.$refs.siteFooter.updateButtonText = 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 };
|
||||
}
|
||||
Loading…
Reference in a new issue