diff --git a/src/constants/vehicle-lookup-alert-types.js b/src/constants/vehicle-lookup-alert-types.js index 3bbf686e..f658876e 100644 --- a/src/constants/vehicle-lookup-alert-types.js +++ b/src/constants/vehicle-lookup-alert-types.js @@ -1,6 +1,7 @@ const vehicleLookupAlertTypes = Object.freeze({ NOT_FOUND: 'notFound', NOT_MATCHED: 'notMatched', + TWO_IDENTICAL_YMM_MATCHED:'twoIdenticalYMMMatched' }); export default vehicleLookupAlertTypes; diff --git a/src/layouts/address-lookup/address-lookup.spec.js b/src/layouts/address-lookup/address-lookup.spec.js index ae7658c5..3bc59b99 100644 --- a/src/layouts/address-lookup/address-lookup.spec.js +++ b/src/layouts/address-lookup/address-lookup.spec.js @@ -56,6 +56,43 @@ describe("address-lookup.vue", () => { ); }); + test("if the address matches two identical YMM vehicles, then display Two Identical YMM Vehicle alert", async () => { + // Arrange + const mockRegistrationAddress = { + streetAddress: "1234 Main St", + city: "Columbus", + state: "OH", + zipCode: "43215", + }; + + const { wrapper } = setupMocks({ + vinVehicles: [ + { + vehicle: { + carId: "C00000", + }, + }, + ], + }); + + useMainStore().order.vehicle.carId = "CARID2"; + + await wrapper.setData({ + customerQuestions: { + addressQuestions: mockRegistrationAddress, + }, + isTwoIdenticalYMMVehicleFound:true, + }); + + // Act + await wrapper.vm.forwardButtonAction(); + + // Assert + expect(wrapper.findComponent({ ref: "alertMatchedTwoIdenticalYMMVehicle" }).isVisible()).toBe( + true + ); + }); + test("if the looking up VIN by address is not allowed in the state selected display the Vin Lookup By HomeAddress Not Allowed Alert", async () => { // Arrange const mockRegistrationAddress = { diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index ec9f5f39..cac1b274 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -29,6 +29,15 @@ :manualCopy="AlertMatchedDifferentVehicleBody" alertClass="alert-warning" v-bind:isDismissible="false" /> + { ); }); + test("If license plate matches two identical YMM vehicles, display alertMatchedTwoIdenticalYMMVehicle", async () => { + // Arrange + const mockRegistrationLicensePlate = { + licensePlate: "UTN990", + }; + + const { wrapper } = setupMocks({}); + + useMainStore().order.vehicle.carId = "TESTCARID"; + + await wrapper.setData({ + licensePlate: mockRegistrationLicensePlate, + isTwoIdenticalYMMVehicleFound:true, + }); + + // Act + await wrapper.vm.forwardButtonAction(); + + // Assert + expect(wrapper.findComponent({ ref: "alertMatchedTwoIdenticalYMMVehicle" }).isVisible()).toBe( + true + ); + }); + test("If no vehicles found, display VinNotFound alert", async () => { // Arrange const mockRegistrationLicensePlate = { diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index d9afacd7..d5d652d2 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -27,6 +27,15 @@ :manualCopy="AlertMatchedDifferentVehicleBody" alertClass="alert-warning" v-bind:isDismissible="false" /> + + + + + \ No newline at end of file diff --git a/src/layouts/vin-lookup/vin-lookup-alerts/vehicle-not-matched-alert/vehicle-not-matched-alert.vue b/src/layouts/vin-lookup/vin-lookup-alerts/vehicle-not-matched-alert/vehicle-not-matched-alert.vue index 1f000e5f..171f76cb 100644 --- a/src/layouts/vin-lookup/vin-lookup-alerts/vehicle-not-matched-alert/vehicle-not-matched-alert.vue +++ b/src/layouts/vin-lookup/vin-lookup-alerts/vehicle-not-matched-alert/vehicle-not-matched-alert.vue @@ -28,14 +28,12 @@ export default { body() { let year = ''; let make = ''; - let model = ''; - let style = ''; + let model = ''; if (this.vehicleFromLookup) { year = this.vehicleFromLookup.year; make = this.vehicleFromLookup.make; - model = this.vehicleFromLookup.model; - style = this.vehicleFromLookup.style; + model = this.vehicleFromLookup.model; } return ( @@ -43,8 +41,7 @@ export default { .replaceAll('{custom:damage}', getDamageString()) .replaceAll('{custom:vinlookupYear}', year) .replaceAll('{custom:vinlookupMake}', make) - .replaceAll('{custom:vinlookupModel}', model) - .replaceAll('{custom:vinlookupStyle}', style) + .replaceAll('{custom:vinlookupModel}', model) ); }, }, diff --git a/src/layouts/vin-lookup/vin-lookup-alerts/vin-lookup-alerts.spec.js b/src/layouts/vin-lookup/vin-lookup-alerts/vin-lookup-alerts.spec.js index e62df817..37b339af 100644 --- a/src/layouts/vin-lookup/vin-lookup-alerts/vin-lookup-alerts.spec.js +++ b/src/layouts/vin-lookup/vin-lookup-alerts/vin-lookup-alerts.spec.js @@ -54,4 +54,18 @@ describe('vin-lookup-alerts.vue', () => { expect(vehicleNotFoundAlert).toEqual(null); expect(vehicleNotMatchedAlert).toBeVisible(); }); + test('TwoIdenticalYMMVehicleAlert is displayed on the screen', () => { + getDamageString.mockImplementation(() => 'Mock Damage String'); + mountOptions.props = { + activeAlertType: vehicleLookupAlertTypes.TWO_IDENTICAL_YMM_MATCHED, + }; + mountOptions.global.provide = { + vehicleFromLookup: {}, + }; + + const { queryByRole } = render(VinLookupAlertsComponent, mountOptions); + const twoIdenticalYMMVehicleAlert = queryByRole('alert', { name: 'two-identical-ymm-vehicle-alert' }); + + expect(twoIdenticalYMMVehicleAlert).toBeVisible(); + }); }); diff --git a/src/layouts/vin-lookup/vin-lookup-alerts/vin-lookup-alerts.vue b/src/layouts/vin-lookup/vin-lookup-alerts/vin-lookup-alerts.vue index 1e6e488a..4ca6f208 100644 --- a/src/layouts/vin-lookup/vin-lookup-alerts/vin-lookup-alerts.vue +++ b/src/layouts/vin-lookup/vin-lookup-alerts/vin-lookup-alerts.vue @@ -6,6 +6,9 @@ + @@ -13,14 +16,17 @@