diff --git a/src/common-components/vehicle-banner/vehicle-banner.spec.js b/src/common-components/vehicle-banner/vehicle-banner.spec.js index 316c9225d..26f1fcf69 100644 --- a/src/common-components/vehicle-banner/vehicle-banner.spec.js +++ b/src/common-components/vehicle-banner/vehicle-banner.spec.js @@ -1,57 +1,12 @@ import { shallowMount } from '@vue/test-utils'; import vehicleBanner from './vehicle-banner'; import { getMountOptions } from "@/helpers/unit-test-helper.js"; -import { storeActions } from "@/constants/store-actions"; -import { nextTick } from 'vue'; describe('vehicleBanner', () => { - const $store = { - state: { - order: { - vehicle: { - vin: null, - year: null, - make: null, - model: null, - style: null - } - } - } - }; - const actionList = { - actionList: [ - { - actionName: storeActions.LOOKUP_VEHICLE_BY_YMMS, - data: [ - { - CarId: "CR00068434" - } - ] - }, - { - actionName: storeActions.LOOKUP_VEHICLE_BY_VIN, - data: [ - { - CarId: "CR00068434" - } - ] - }, - { - actionName: storeActions.GET_EVOX_IMAGE, - data: { - imgSrc: "https://s3.amazonaws.com/safelite-lab-vehicle-images/Evox/8963_cc0320_032_UG_white_2014_Ford_Focus_18029225538399034889.jpg" - } - } - ] - }; - test('renders the blurrycar image when vehicleImageSrc is not present', () => { + test('renders the blurrycar image', () => { // Arrange - const mountOptions = getMountOptions(actionList); - mountOptions.global.mocks = { - ...mountOptions.global.mocks, - $store - } + const mountOptions = getMountOptions(); // Act const wrapper = shallowMount(vehicleBanner, { ...mountOptions @@ -61,84 +16,4 @@ describe('vehicleBanner', () => { wrapper.unmount(); }); - test('does not render the blurrycar image when vehicleImageSrc exists', () => { - // Arrange - const mountOptions = getMountOptions(actionList); - mountOptions.global.mocks = { - ...mountOptions.global.mocks, - $store - } - // Act - const wrapper = shallowMount(vehicleBanner, { - ...mountOptions, - data() { - return { - vehicleImageSrc: "https://s3.amazonaws.com/safelite-lab-vehicle-images/Evox/8963_cc0320_032_UG_white_2014_Ford_Focus_18029225538399034889.jpg" - } - } - }); - // Assert - expect(wrapper.find('img').attributes('class')).not.toContain('blurrycar'); - wrapper.unmount(); - }); - - test('does not render the blurrycar image when passedCarId is set', async () => { - // Arrange - const mountOptions = getMountOptions(actionList); - mountOptions.global.mocks = { - ...mountOptions.global.mocks, - $store, - } - // Act - const wrapper = shallowMount(vehicleBanner, { - ...mountOptions, - props: { - passedCarId: "CR00068434" - } - }); - // Assert - await nextTick(); - expect(wrapper.find('img').attributes('class')).not.toContain('blurrycar'); - wrapper.unmount(); - }); - - test('receives a carId when a YMMS object is found', async () => { - // Arrange - $store.state.order.vehicle.year = "2019" - $store.state.order.vehicle.make = "acura" - $store.state.order.vehicle.model = "rdx" - $store.state.order.vehicle.style = "4 door utility" - const mountOptions = getMountOptions(actionList); - mountOptions.global.mocks = { - ...mountOptions.global.mocks, - $store - } - // Act - const wrapper = shallowMount(vehicleBanner, { - ...mountOptions - }); - // Assert - await nextTick(); - expect(wrapper.vm.$data.carId.length).toBeGreaterThan(0); - wrapper.unmount(); - }); - - test('receives a carId when a VIN is found', async () => { - // Arrange - $store.state.order.vehicle.vin = "1J4GW58S4XC541166"; - const mountOptions = getMountOptions(actionList); - mountOptions.global.mocks = { - ...mountOptions.global.mocks, - $store - } - // Act - const wrapper = shallowMount(vehicleBanner, { - ...mountOptions - }); - // Assert - await nextTick(); - expect(wrapper.vm.$data.carId.length).toBeGreaterThan(0); - wrapper.unmount(); - }); - }); diff --git a/src/common-components/vehicle-banner/vehicle-banner.vue b/src/common-components/vehicle-banner/vehicle-banner.vue index 36642288d..c4f853e07 100644 --- a/src/common-components/vehicle-banner/vehicle-banner.vue +++ b/src/common-components/vehicle-banner/vehicle-banner.vue @@ -1,16 +1,9 @@ @@ -18,59 +11,8 @@ diff --git a/src/layouts/component-test/component-test.vue b/src/layouts/component-test/component-test.vue index ff80496fc..32af13564 100644 --- a/src/layouts/component-test/component-test.vue +++ b/src/layouts/component-test/component-test.vue @@ -314,8 +314,7 @@