diff --git a/src/commonComponents/vehicleBanner/vehicleBanner.spec.js b/src/commonComponents/vehicleBanner/vehicleBanner.spec.js index 703d3c4d2..c8bcede15 100644 --- a/src/commonComponents/vehicleBanner/vehicleBanner.spec.js +++ b/src/commonComponents/vehicleBanner/vehicleBanner.spec.js @@ -1,41 +1,56 @@ -import { mount } from '@vue/test-utils'; +import { mount, flushPromises } from '@vue/test-utils'; import vehicleBanner from './vehicleBanner'; +import axios from 'axios'; + +jest.mock('axios', () => ({ + get: () => Promise.resolve({ data: '"imgSrc": "https://s3.amazonaws.com/safelite-lab-vehicle-images/Evox/8963_cc0320_032_UG_white_2014_Ford_Focus_18029225538399034889.jpg"' }) +})) describe('vehicleBanner with no props', () => { - + // Arrange const wrapper = mount(vehicleBanner, { propsData: {} }); + // Act + // Assert it('renders the blurrycar image', () => { expect(wrapper.find('img').attributes('class')).toContain('blurrycar'); }) }); describe('vehicleBanner with isBlurred true', () => { - + // Arrange const wrapper = mount(vehicleBanner, { propsData: { isBlurred: true, carId: "00test" } }); + // Act + // Assert it('renders the blurrycar image', () => { expect(wrapper.find('img').attributes('class')).toContain('blurrycar'); }) }); describe('vehicleBanner with valid src image', () => { - + // Arrange const wrapper = mount(vehicleBanner, { propsData: { carId: "00test" } }); - - it('does not render the blurry image', () => { - expect(wrapper.find('img').attributes('class')).not.toContain('blurrycar'); + // Act + + // Assert + it('does not render the blurry image', async () => { + await flushPromises(); + + setTimeout(() => { + expect(wrapper.find('img').attributes('class')).not.toContain('blurrycar'); + }, 500); }) }); diff --git a/src/commonComponents/vehicleBanner/vehicleBanner.vue b/src/commonComponents/vehicleBanner/vehicleBanner.vue index e12440df4..461657080 100644 --- a/src/commonComponents/vehicleBanner/vehicleBanner.vue +++ b/src/commonComponents/vehicleBanner/vehicleBanner.vue @@ -15,10 +15,15 @@ diff --git a/src/global-methods.js b/src/global-methods.js index 06e2dcfb4..824a87266 100644 --- a/src/global-methods.js +++ b/src/global-methods.js @@ -30,25 +30,3 @@ export default { }); }, }; - -export function mockEvoxCall(carId) { - // console.log('running mockEvoxCall...'); - if (carId) { - return "https://s3.amazonaws.com/safelite-lab-vehicle-images/Evox/8963_cc0320_032_UG_white_2014_Ford_Focus_18029225538399034889.jpg" - // "https://s7g10.scene7.com/is/image/maserati/maserati/international/Models/default/2022/ghibli/gh_front.png?$600x2000$&fmt=png-alpha&fit=constrain"; - } -}; - -export function mockGetCarId(vin, ymmsObj) { - // console.log('running mockGetCardId...'); - if (vin) { - // TODO make API call with vin here - return "owuetr98"; - } - if (ymmsObj) { - // TODO make API call with yearMakeModelStyle object here - console.log('ymmsObj: ', ymmsObj) - return "fhgmsg"; - } - return; -} diff --git a/src/layouts/componentTest/componentTest.vue b/src/layouts/componentTest/componentTest.vue index 0f3c70aef..c0a8f9b93 100644 --- a/src/layouts/componentTest/componentTest.vue +++ b/src/layouts/componentTest/componentTest.vue @@ -87,6 +87,17 @@