diff --git a/src/layouts/policy-vehicles/policy-vehicles.spec.js b/src/layouts/policy-vehicles/policy-vehicles.spec.js index 1d2f6875..5cecac66 100644 --- a/src/layouts/policy-vehicles/policy-vehicles.spec.js +++ b/src/layouts/policy-vehicles/policy-vehicles.spec.js @@ -4,7 +4,6 @@ import { shallowMount } from "@vue/test-utils"; import { getMountOptions } from "@/helpers/unit-test-helper.js"; import { useMainStore } from "@/store"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; -import {vehicleSelectionOptions} from "@/constants/vehicle-selection-options"; import { navigationScenarios } from "@/router/router-constants/navigation-scenarios"; // Mock fetchCmsContentForPage @@ -33,17 +32,6 @@ describe("policy-vehicles.vue", () => { //Assert expect(wrapper.vm.$router.navigate).toBeCalled(); }); - test("Should navigate to CLICKED_BACK if backButtonAction is run", async () => { - // Arrange - const { wrapper } = setupMocks({}); - - // Act - await wrapper.vm.backButtonAction(); - - //Assert - expect(wrapper.vm.$router.navigate).toBeCalled(); - }); - test("Selected vehicle VIN do match vehicles listed in our system (CarIDs) found then navigate forward to vehicle-damage page.", async () => { //Arrange const { wrapper } = setupMocks({}); @@ -87,7 +75,7 @@ describe("policy-vehicles.vue", () => { // Act await wrapper.setData({ - selectedVehicleVin: vehicleSelectionOptions.VEHICLE_NOT_LISTED, + selectedVehicleVin: "Vehicle not listed", }); await wrapper.vm.forwardButtonAction(); @@ -99,6 +87,16 @@ describe("policy-vehicles.vue", () => { {} ); }); + test("first vehicle is auto-selected if only one vehicle on policy", async () => { + //Arrange + const { wrapper } = setupMocks({}); + + // Act + await wrapper.vm.$nextTick(); + + // Assert + expect(wrapper.vm.selectedVehicleVin).toBe("5NMS3CADXLH233004"); + }); }); function setupMocks({ @@ -109,15 +107,15 @@ function setupMocks({ useMainStore().applicationUser = { pageData: { "policy-vehicles": - [ - { - vehicleMake: "Hyundai", - vehicleModel: "Santa Fe", - vehicleStyle: "4 door utility", - vehicleYear: 2020, - vin: "5NMS3CADXLH233004", - }, - ], + [ + { + vehicleMake: "Hyundai", + vehicleModel: "Santa Fe", + vehicleStyle: "4 door utility", + vehicleYear: 2020, + vin: "5NMS3CADXLH233004", + }, + ], } }; useMainStore().lookupVehicleByVin = jest.fn().mockImplementation(() => { diff --git a/src/layouts/policy-vehicles/policy-vehicles.vue b/src/layouts/policy-vehicles/policy-vehicles.vue index a85cc583..f38516f6 100644 --- a/src/layouts/policy-vehicles/policy-vehicles.vue +++ b/src/layouts/policy-vehicles/policy-vehicles.vue @@ -8,7 +8,7 @@
- + 1) { + this.displayGeneric = true; + } + else { + // display clear image of vehicle + this.displayGeneric = false; + } + } + } + }, components: { siteHeader, siteFooter,