fix tests and a cursor issue.
This commit is contained in:
parent
8fefa39fea
commit
dcfccfd916
2 changed files with 16 additions and 39 deletions
|
|
@ -62,10 +62,10 @@ export async function getAvailabilityRating(
|
||||||
|
|
||||||
const numberOfDaysToEvaluate = 2;
|
const numberOfDaysToEvaluate = 2;
|
||||||
const isGoodAvailability =
|
const isGoodAvailability =
|
||||||
shopTimeSlots.data.days.filter((x) => x.timeSlots.length > 6).length
|
shopTimeSlots.data.days.filter((x) => x.timeSlots.length > 0).length
|
||||||
>= numberOfDaysToEvaluate;
|
>= numberOfDaysToEvaluate;
|
||||||
|
|
||||||
const shopStatus = isGoodAvailability ? 'high' : 'low';
|
const shopStatus = isGoodAvailability ? 'high' : 'lowww';
|
||||||
|
|
||||||
return Promise.resolve(shopStatus);
|
return Promise.resolve(shopStatus);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -127,20 +127,19 @@ afterEach(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('schedule-page.vue', () => {
|
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', () => {
|
describe('Initial Load', () => {
|
||||||
test('Should pass arePagePrerequisitesValid with a mobile order and no providerNumber', () => {
|
test('Should pass arePagePrerequisitesValid with a serviceLocation zipcode [in beforeEach]', () => {
|
||||||
// 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', () => {
|
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = getShallowMountedComponent();
|
const { wrapper } = getShallowMountedComponent();
|
||||||
|
|
||||||
|
|
@ -150,10 +149,10 @@ describe('schedule-page.vue', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(arePagePrerequisitesValid).toBe(true);
|
expect(arePagePrerequisitesValid).toBe(true);
|
||||||
});
|
});
|
||||||
test('Should fail arePagePrerequisitesValid with an inshop order and no providerNumber', () => {
|
test('Should fail arePagePrerequisitesValid with no serviceLocation zipcode', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = getShallowMountedComponent();
|
const { wrapper } = getShallowMountedComponent();
|
||||||
wrapper.vm.mainStore.order.serviceLocation.provider.providerNumber = null;
|
wrapper.vm.mainStore.order.serviceLocation.zipCode = null;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid();
|
const arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid();
|
||||||
|
|
@ -161,28 +160,6 @@ describe('schedule-page.vue', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(arePagePrerequisitesValid).toBeFalsy();
|
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 () => {
|
test('should return newShopTimeSlots when getAvailableDatesMethod is called', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = getShallowMountedComponent();
|
const { wrapper } = getShallowMountedComponent();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue