remove unit tests for unused alert
This commit is contained in:
parent
96574ed187
commit
2ae6dbd2dc
7 changed files with 3 additions and 321 deletions
|
|
@ -2,8 +2,7 @@ const vehicleLookupAlertTypes = Object.freeze({
|
|||
NOT_FOUND: 'notFound',
|
||||
NOT_MATCHED: 'notMatched',
|
||||
TWO_IDENTICAL_YMM_MATCHED: 'twoIdenticalYMMMatched',
|
||||
PERFECT_MATCH: 'perfectMatch',
|
||||
NO_SERVICE: 'noService'
|
||||
PERFECT_MATCH: 'perfectMatch'
|
||||
});
|
||||
|
||||
export default vehicleLookupAlertTypes;
|
||||
|
|
|
|||
|
|
@ -466,76 +466,5 @@ describe('address-lookup.vue', () => {
|
|||
// Assert
|
||||
expect(wrapper.vm.navigateForwardWithSingleCarMatch).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test('selected vehicle is a non-serviceable big truck, display no service alert', async () => {
|
||||
// Arrange
|
||||
const mockRegistrationAddress = {
|
||||
streetAddress: '1234 Main St',
|
||||
city: 'Columbus',
|
||||
state: 'OH',
|
||||
zipCode: '43215'
|
||||
};
|
||||
|
||||
const { wrapper } = setupMocks({
|
||||
vinVehicles: [
|
||||
{
|
||||
vehicle: {
|
||||
carId: 'BIGTRUCKCARID',
|
||||
isBigTruck: true,
|
||||
canSafeliteService: false
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
useMainStore().order.vehicle.carId = 'BIGTRUCKCARID';
|
||||
|
||||
await wrapper.setData({
|
||||
customerQuestions: {
|
||||
addressQuestions: mockRegistrationAddress
|
||||
}
|
||||
});
|
||||
|
||||
// Act
|
||||
await wrapper.vm.forwardButtonAction();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.findComponent({ ref: 'alertNoService' }).isVisible()).toBe(true);
|
||||
});
|
||||
test('selected vehicle is a serviceable big truck, do not display no service alert', async () => {
|
||||
// Arrange
|
||||
const mockRegistrationAddress = {
|
||||
streetAddress: '1234 Main St',
|
||||
city: 'Columbus',
|
||||
state: 'OH',
|
||||
zipCode: '43215'
|
||||
};
|
||||
|
||||
const { wrapper } = setupMocks({
|
||||
vinVehicles: [
|
||||
{
|
||||
vehicle: {
|
||||
carId: 'BIGTRUCKCARID2',
|
||||
isBigTruck: true,
|
||||
canSafeliteService: true
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
useMainStore().order.vehicle.carId = 'BIGTRUCKCARID2';
|
||||
|
||||
await wrapper.setData({
|
||||
customerQuestions: {
|
||||
addressQuestions: mockRegistrationAddress
|
||||
}
|
||||
});
|
||||
|
||||
// Act
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.findComponent({ ref: 'alertNoService' }).exists()).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -247,94 +247,4 @@ describe('address-vehicles.vue', () => {
|
|||
// Assert
|
||||
expect(arePagePrerequisitesValid).toBe(true);
|
||||
});
|
||||
|
||||
test('selected vehicle is a non-serviceable big truck, display no service alert', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
useMainStore().order.vehicle.carId = 'BIGTRUCKCARID';
|
||||
useMainStore().applicationUser = {
|
||||
pageData: {
|
||||
'address-vehicles':
|
||||
[
|
||||
{
|
||||
vehicle: {
|
||||
carId: 'BIGTRUCKCARID',
|
||||
make: 'Isuzu',
|
||||
model: 'Reach',
|
||||
style: 'Step Van',
|
||||
year: 2016,
|
||||
isBigTruck: true,
|
||||
canSafeliteService: false
|
||||
},
|
||||
vin: 'BIGTRUCKVIN'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
await wrapper.setData({
|
||||
selectedVehicleVin: 'BIGTRUCKVIN',
|
||||
previouslyEnteredCarId: 'BIGTRUCKCARID'
|
||||
});
|
||||
|
||||
wrapper.vm.selectedVehicle = {
|
||||
vin: 'BIGTRUCKVIN',
|
||||
vehicle: {
|
||||
carId: 'BIGTRUCKCARID',
|
||||
isBigTruck: true,
|
||||
canSafeliteService: false
|
||||
}
|
||||
};
|
||||
|
||||
// Act
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.findComponent({ ref: 'AlertNoService' }).isVisible()).toBe(true);
|
||||
});
|
||||
|
||||
test('selected vehicle is a serviceable big truck, do not display no service alert', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
useMainStore().order.vehicle.carId = 'BIGTRUCKCARID2';
|
||||
useMainStore().applicationUser = {
|
||||
pageData: {
|
||||
'address-vehicles':
|
||||
[
|
||||
{
|
||||
vehicle: {
|
||||
carId: 'BIGTRUCKCARID2',
|
||||
make: 'Mack',
|
||||
model: 'Terrapro',
|
||||
style: 'Cabover',
|
||||
year: 2024,
|
||||
isBigTruck: true,
|
||||
canSafeliteService: true
|
||||
},
|
||||
vin: 'BIGTRUCKVIN2'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
await wrapper.setData({
|
||||
selectedVehicleVin: 'BIGTRUCKVIN2',
|
||||
previouslyEnteredCarId: 'BIGTRUCKCARID2'
|
||||
});
|
||||
|
||||
wrapper.vm.selectedVehicle = {
|
||||
vin: 'BIGTRUCKVIN2',
|
||||
vehicle: {
|
||||
carId: 'BIGTRUCKCARID2',
|
||||
isBigTruck: true,
|
||||
canSafeliteService: true
|
||||
}
|
||||
};
|
||||
|
||||
// Act
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.findComponent({ ref: 'AlertNoService' }).exists()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -151,68 +151,6 @@ describe('license-plate-lookup.vue', () => {
|
|||
// Assert
|
||||
expect(wrapper.findComponent({ ref: 'alertVinNotFound' }).isVisible()).toBe(true);
|
||||
});
|
||||
test('non-serviceable big truck found, display NoServiceAlert', async () => {
|
||||
// Arrange
|
||||
const mockRegistrationLicensePlate = {
|
||||
licensePlate: 'BIGTRUCKTEST'
|
||||
};
|
||||
|
||||
const { wrapper } = setupMocks({
|
||||
lookupVinByPlateResponse: {
|
||||
vin: 'BIGTRUCKVIN',
|
||||
vehicle: {
|
||||
carId: 'BIGTRUCKTESTCARID',
|
||||
isBigTruck: true,
|
||||
canSafeliteService: false
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
useMainStore().order.vehicle.carId = 'BIGTRUCKTESTCARID';
|
||||
|
||||
await wrapper.setData({
|
||||
licensePlate: mockRegistrationLicensePlate
|
||||
});
|
||||
|
||||
wrapper.vm.navigateForward = jest.fn();
|
||||
|
||||
// Act
|
||||
await wrapper.vm.forwardButtonAction();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.findComponent({ ref: 'alertNoService' }).isVisible()).toBe(true);
|
||||
});
|
||||
test('serviceable big truck found, do not display NoServiceAlert', async () => {
|
||||
// Arrange
|
||||
const mockRegistrationLicensePlate = {
|
||||
licensePlate: 'BIGTRUCKTEST2'
|
||||
};
|
||||
|
||||
const { wrapper } = setupMocks({
|
||||
lookupVinByPlateResponse: {
|
||||
vin: 'BIGTRUCKVIN2',
|
||||
vehicle: {
|
||||
carId: 'BIGTRUCKTESTCARID2',
|
||||
isBigTruck: true,
|
||||
canSafeliteService: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
useMainStore().order.vehicle.carId = 'BIGTRUCKTESTCARID2';
|
||||
|
||||
await wrapper.setData({
|
||||
licensePlate: mockRegistrationLicensePlate
|
||||
});
|
||||
|
||||
wrapper.vm.navigateForward = jest.fn();
|
||||
|
||||
// Act
|
||||
await wrapper.vm.forwardButtonAction();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.findComponent({ ref: 'alertNoService' }).exists()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('navigation', () => {
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@ import { getRandomString, getRandomInt } from '@/helpers/data-generation';
|
|||
import endorsementOptions from '@/constants/endorsement-options';
|
||||
import { createTestingPinia } from '@pinia/testing';
|
||||
import vehicleSelectionOptions from '@/constants/vehicle-selection-options';
|
||||
import bailoutCode from '@/constants/bailoutCode';
|
||||
import bailoutMessage from '@/constants/bailoutMessage';
|
||||
import issPageValues from '@/router/router-constants/issPage-values';
|
||||
|
||||
// Mock fetchCmsContentForPage
|
||||
|
|
@ -42,7 +40,8 @@ const mockMixin = {
|
|||
function setupMocks() {
|
||||
const mountOptions = getMountOptions({
|
||||
router: {
|
||||
navigate: jest.fn()
|
||||
navigate: jest.fn(),
|
||||
navigateBailout: jest.fn()
|
||||
},
|
||||
mixins: [mockMixin],
|
||||
global: {
|
||||
|
|
@ -720,54 +719,4 @@ describe('policy-vehicles.vue', () => {
|
|||
// Assert
|
||||
expect(wrapper.vm.selectedVehicleVin).toBe(vin);
|
||||
});
|
||||
|
||||
test('selected vehicle is a non-serviceable big truck, display no service alert', async () => {
|
||||
// Arrange
|
||||
const vin = getRandomString(17, 17);
|
||||
const policyVehicle = {
|
||||
vin,
|
||||
isBigTruck: true,
|
||||
canSafeliteService: false
|
||||
};
|
||||
|
||||
const { wrapper } = setupMocks({});
|
||||
|
||||
await wrapper.setData({
|
||||
selectedVehicleVin: vin,
|
||||
selectedPolicyVehicle: policyVehicle,
|
||||
policyVehicles: [policyVehicle],
|
||||
policyVinFound: true
|
||||
});
|
||||
|
||||
wrapper.vm.displayNoServiceAlert = true;
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.findComponent({ ref: 'AlertNoService' }).isVisible()).toBe(true);
|
||||
});
|
||||
|
||||
test('selected vehicle is a serviceable big truck, do not display no service alert', async () => {
|
||||
// Arrange
|
||||
const vin = getRandomString(17, 17);
|
||||
const policyVehicle = {
|
||||
vin,
|
||||
isBigTruck: true,
|
||||
canSafeliteService: true
|
||||
};
|
||||
|
||||
const { wrapper } = setupMocks({});
|
||||
|
||||
await wrapper.setData({
|
||||
selectedVehicleVin: vin,
|
||||
selectedPolicyVehicle: policyVehicle,
|
||||
policyVehicles: [policyVehicle],
|
||||
policyVinFound: true
|
||||
});
|
||||
|
||||
wrapper.vm.displayNoServiceAlert = false;
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.findComponent({ ref: 'AlertNoService' }).exists()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -67,17 +67,4 @@ describe('vin-lookup-alerts.vue', () => {
|
|||
|
||||
expect(twoIdenticalYMMVehicleAlert).toBeVisible();
|
||||
});
|
||||
test('NoServiceAlert is displayed on the screen', () => {
|
||||
mountOptions.props = {
|
||||
activeAlertType: vehicleLookupAlertTypes.NO_SERVICE
|
||||
};
|
||||
mountOptions.global.provide = {
|
||||
vehicleFromLookup: {}
|
||||
};
|
||||
|
||||
const { queryByRole } = render(VinLookupAlertsComponent, mountOptions);
|
||||
const noServiceAlert = queryByRole('alert', { name: 'no-service-alert' });
|
||||
|
||||
expect(noServiceAlert).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -488,36 +488,6 @@ describe('vin-lookup.vue', () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
test('Display no service alert if entered vin cannot be serviced', async () => {
|
||||
const user = userEvent.setup();
|
||||
mountOptions.global.stubs.vinQuestion = false;
|
||||
|
||||
mountOptions.data = () => ({
|
||||
vinWithNonMatchingCarId: false,
|
||||
isCarIdDifferentFromTheStore: false,
|
||||
vin: mockValidVin
|
||||
});
|
||||
|
||||
getPartsOrQuestions.mockResponse = vehicleWithNoAdditionalPartsOrQuestionsMockResponse;
|
||||
|
||||
jest.spyOn(VinLookupComponent.methods, lookupVehicleByVin.methodName)
|
||||
.mockResolvedValue(lookupVehicleByVinCannotService.mockResponse);
|
||||
jest.spyOn(vehicleQuestionsMixin.methods, getPartsOrQuestions.methodName)
|
||||
.mockResolvedValue(getPartsOrQuestions.mockResponse);
|
||||
|
||||
const { container } = render(VinLookupComponent, mountOptions);
|
||||
|
||||
const vinInput = container.querySelector(vinInputSelector);
|
||||
await user.type(vinInput, mockValidVin);
|
||||
|
||||
const continueButton = container.querySelector(continueButtonQuerySelector);
|
||||
await user.click(continueButton);
|
||||
|
||||
await flushPromises();
|
||||
await waitFor(() => {
|
||||
expect(container).toContainHTML('noService');
|
||||
});
|
||||
});
|
||||
|
||||
test('Policy Vehicle with invalid vin corrected. Click "Continue", execute navigate with navigationScenario.CORRECTED_VIN_FROM_POLICY_VEHICLE', async () => {
|
||||
const user = userEvent.setup();
|
||||
|
|
|
|||
Loading…
Reference in a new issue