diff --git a/src/helpers/service-location-helper.js b/src/helpers/service-location-helper.js index 25265ea6..2866366e 100644 --- a/src/helpers/service-location-helper.js +++ b/src/helpers/service-location-helper.js @@ -62,10 +62,10 @@ export async function getAvailabilityRating( const numberOfDaysToEvaluate = 2; const isGoodAvailability = - shopTimeSlots.data.days.filter((x) => x.timeSlots.length > 6).length + shopTimeSlots.data.days.filter((x) => x.timeSlots.length > 0).length >= numberOfDaysToEvaluate; - const shopStatus = isGoodAvailability ? 'high' : 'low'; + const shopStatus = isGoodAvailability ? 'high' : 'lowww'; return Promise.resolve(shopStatus); } diff --git a/src/layouts/schedule-page/schedule-page.spec.js b/src/layouts/schedule-page/schedule-page.spec.js index 133654da..24edd333 100644 --- a/src/layouts/schedule-page/schedule-page.spec.js +++ b/src/layouts/schedule-page/schedule-page.spec.js @@ -127,20 +127,19 @@ afterEach(() => { }); describe('schedule-page.vue', () => { + beforeAll(() => { + Object.defineProperty(window, 'matchMedia', { value: jest.fn().mockImplementation((query) => ({ + matches: false, + media: query, + onchange: null, + addEventListener: jest.fn(), + removeEventListener: jest.fn(), + dispatchEvent: jest.fn() + })), + writable: true }); + }); describe('Initial Load', () => { - test('Should pass arePagePrerequisitesValid with a mobile order and no providerNumber', () => { - // Arrange - const { wrapper } = getShallowMountedComponent(); - wrapper.vm.mainStore.order.serviceLocation.appointmentType = 'Mobile'; - wrapper.vm.mainStore.order.serviceLocation.provider = null; - - // Act - const arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid(); - - // Assert - expect(arePagePrerequisitesValid).toBe(true); - }); - test('Should pass arePagePrerequisitesValid with an inshop order and providerNumber', () => { + test('Should pass arePagePrerequisitesValid with a serviceLocation zipcode [in beforeEach]', () => { // Arrange const { wrapper } = getShallowMountedComponent(); @@ -150,10 +149,10 @@ describe('schedule-page.vue', () => { // Assert expect(arePagePrerequisitesValid).toBe(true); }); - test('Should fail arePagePrerequisitesValid with an inshop order and no providerNumber', () => { + test('Should fail arePagePrerequisitesValid with no serviceLocation zipcode', () => { // Arrange const { wrapper } = getShallowMountedComponent(); - wrapper.vm.mainStore.order.serviceLocation.provider.providerNumber = null; + wrapper.vm.mainStore.order.serviceLocation.zipCode = null; // Act const arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid(); @@ -161,28 +160,6 @@ describe('schedule-page.vue', () => { // Assert expect(arePagePrerequisitesValid).toBeFalsy(); }); - test('Should fail arePagePrerequisitesValid if supportingItems is null', async () => { - // Arrange - const { wrapper } = getShallowMountedComponent(); - wrapper.vm.mainStore.order.lineItems.supportingItems = null; - - // Act - const arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid(); - - // Assert - expect(arePagePrerequisitesValid).toBe(false); - }); - test('Should fail arePagePrerequisitesValid with an replace with no glass parts', async () => { - // Arrange - const { wrapper } = getShallowMountedComponent(); - wrapper.vm.mainStore.order.lineItems.glassParts = []; - - // Act - const arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid(); - - // Assert - expect(arePagePrerequisitesValid).toBe(false); - }); test('should return newShopTimeSlots when getAvailableDatesMethod is called', async () => { // Arrange const { wrapper } = getShallowMountedComponent();