INSR-7757: Fix some tests
This commit is contained in:
parent
8bf7d282d4
commit
32bf06ea59
8 changed files with 91 additions and 308 deletions
|
|
@ -7,19 +7,21 @@ Object {
|
|||
"MOBILE_FEE": "MOBILE FEE",
|
||||
"RECYCLE_FEE": "RECYCLE FEE",
|
||||
"VAP": "VAP",
|
||||
"WARRANTY": "WARRANTY",
|
||||
},
|
||||
"isExpanded": false,
|
||||
"widget": Object {
|
||||
"amountDue": "AmountDueTextWidget",
|
||||
"amountPaid": "AmountPaidTextWidget",
|
||||
"basePrice": "BasePriceWidget",
|
||||
"deductible": "DeductibleWidget",
|
||||
"guaranteeText": "GuaranteeCartItemTextWidget",
|
||||
"mobileFee": "MobileServiceWidget",
|
||||
"recycleFee": "RecycleFeeWidget",
|
||||
"salesTax": "SalesTaxWidget",
|
||||
"servicePackage": "ServicePackageTitle",
|
||||
"subtotal": "SubtotalWidget",
|
||||
"vapsItemDescriptions": "VapsItemDescriptions",
|
||||
"warrantyText": "WarrantyCartItemTextWidget",
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
|
|
|||
|
|
@ -73,47 +73,10 @@ describe('cart-dropdown component', () => {
|
|||
expect(wrapper.vm.$data).toMatchSnapshot();
|
||||
});
|
||||
describe('displays', () => {
|
||||
test('cart dropdown head', () => {
|
||||
// Arrange
|
||||
const reference = '#cart-dropdown-head';
|
||||
const { wrapper } = getMountedComponent(cartDropdown);
|
||||
|
||||
// Act
|
||||
const head = wrapper.find(reference);
|
||||
|
||||
// Assert
|
||||
expect(head.exists()).toBeTruthy();
|
||||
});
|
||||
test('cart dropdown head is visible', () => {
|
||||
// Arrange
|
||||
const reference = '#cart-dropdown-head';
|
||||
const { wrapper } = getMountedComponent(cartDropdown, {}, { showDropdownHeader: true });
|
||||
|
||||
// Act
|
||||
const head = wrapper.find(reference);
|
||||
|
||||
// Assert
|
||||
expect(head.exists()).toBeTruthy();
|
||||
expect(head.classes()).toContain('cart-toggle');
|
||||
});
|
||||
test('cart dropdown head is not visible', () => {
|
||||
// Arrange
|
||||
const reference = '#cart-dropdown-head';
|
||||
const { wrapper } = getMountedComponent(cartDropdown, {}, { showDropdownHeader: false });
|
||||
|
||||
// Act
|
||||
const head = wrapper.find(reference);
|
||||
|
||||
// Assert
|
||||
expect(head.exists()).toBeTruthy();
|
||||
expect(head.classes()).not.toContain('cart-toggle');
|
||||
});
|
||||
test('cart table', () => {
|
||||
// Arrange
|
||||
const reference = '#cart-table';
|
||||
const isExpanded = true;
|
||||
const initialData = { isExpanded };
|
||||
const { wrapper } = getMountedComponent({}, {}, initialData);
|
||||
const reference = '.cart-table';
|
||||
const { wrapper } = getMountedComponent({}, {}, {});
|
||||
|
||||
// Act
|
||||
const cartTable = wrapper.find(reference);
|
||||
|
|
@ -121,11 +84,9 @@ describe('cart-dropdown component', () => {
|
|||
// Assert
|
||||
expect(cartTable.exists()).toBeTruthy();
|
||||
});
|
||||
test('cart deductible when showDeductibleLineItem is true', () => {
|
||||
test('cart deductible when showDeductibleCartItem is true', () => {
|
||||
// Arrange
|
||||
const reference = '#cart-deductible';
|
||||
const isExpanded = true;
|
||||
const initialData = { isExpanded };
|
||||
const reference = '#deductible-label';
|
||||
const storeData = {
|
||||
order: {
|
||||
insuranceCoverage: {
|
||||
|
|
@ -134,7 +95,7 @@ describe('cart-dropdown component', () => {
|
|||
}
|
||||
}
|
||||
};
|
||||
const { wrapper } = getMountedComponent(storeData, {}, initialData);
|
||||
const { wrapper } = getMountedComponent(storeData, {}, {});
|
||||
|
||||
// Act
|
||||
const cartDeductible = wrapper.find(reference);
|
||||
|
|
@ -144,9 +105,7 @@ describe('cart-dropdown component', () => {
|
|||
});
|
||||
test('cart base price when showDeductibleLineItem is false', () => {
|
||||
// Arrange
|
||||
const reference = '#cart-base-price';
|
||||
const isExpanded = true;
|
||||
const initialData = { isExpanded };
|
||||
const reference = '#base-price-label';
|
||||
const storeData = {
|
||||
order: {
|
||||
currentDeductible: 0,
|
||||
|
|
@ -160,7 +119,7 @@ describe('cart-dropdown component', () => {
|
|||
isClaimRegistrationRequired: true
|
||||
}
|
||||
};
|
||||
const { wrapper } = getMountedComponent(storeData, {}, initialData);
|
||||
const { wrapper } = getMountedComponent(storeData, {}, {});
|
||||
|
||||
// Act
|
||||
const cartBasePrice = wrapper.find(reference);
|
||||
|
|
@ -168,25 +127,32 @@ describe('cart-dropdown component', () => {
|
|||
// Assert
|
||||
expect(cartBasePrice.exists()).toBeTruthy();
|
||||
});
|
||||
test('service package', () => {
|
||||
// Arrange
|
||||
const reference = '#cart-service-package';
|
||||
const isExpanded = true;
|
||||
const initialData = { isExpanded };
|
||||
const { wrapper } = getMountedComponent({}, {}, initialData);
|
||||
|
||||
// Act
|
||||
const servicePackage = wrapper.find(reference);
|
||||
|
||||
// Assert
|
||||
expect(servicePackage.exists()).toBeTruthy();
|
||||
});
|
||||
test('non service package cart items', () => {
|
||||
// Arrange
|
||||
const reference = '#non-packaged-cart-items';
|
||||
const isExpanded = true;
|
||||
const initialData = { isExpanded };
|
||||
const { wrapper } = getMountedComponent({}, {}, initialData);
|
||||
const reference = '.non-packaged.cart-item';
|
||||
const part1 = { partType: 'apple' };
|
||||
const part2 = { partType: 'banana' };
|
||||
const part3 = { partType: 'orange' };
|
||||
const mobileFee = { partType: 'mobile' };
|
||||
const storeData = {
|
||||
order: {
|
||||
currentDeductible: 0,
|
||||
lineItems: {
|
||||
glassParts: [part1],
|
||||
supportingItems: [part2, part3],
|
||||
otherParts: [],
|
||||
feeItems: [mobileFee]
|
||||
},
|
||||
insuranceCoverage: {
|
||||
coverageStatus: coverageStatuses.VERIFIED,
|
||||
coverageType: coverageType.ITAC
|
||||
}
|
||||
},
|
||||
issConfig: {
|
||||
isClaimRegistrationRequired: true
|
||||
}
|
||||
};
|
||||
const { wrapper } = getMountedComponent(storeData, {}, {});
|
||||
|
||||
// Act
|
||||
const nonPackagedCartItems = wrapper.find(reference);
|
||||
|
|
@ -220,9 +186,7 @@ describe('cart-dropdown component', () => {
|
|||
test('cart footer', () => {
|
||||
// Arrange
|
||||
const reference = '#cart-footer';
|
||||
const isExpanded = true;
|
||||
const initialData = { isExpanded };
|
||||
const { wrapper } = getMountedComponent({}, {}, initialData);
|
||||
const { wrapper } = getMountedComponent({}, {}, {});
|
||||
|
||||
// Act
|
||||
const cartFooter = wrapper.find(reference);
|
||||
|
|
@ -233,9 +197,7 @@ describe('cart-dropdown component', () => {
|
|||
test('subtotal', () => {
|
||||
// Arrange
|
||||
const reference = '#cart-subtotal';
|
||||
const isExpanded = true;
|
||||
const initialData = { isExpanded };
|
||||
const { wrapper } = getMountedComponent({}, {}, initialData);
|
||||
const { wrapper } = getMountedComponent({}, {}, {});
|
||||
|
||||
// Act
|
||||
const subtotal = wrapper.find(reference);
|
||||
|
|
@ -246,9 +208,7 @@ describe('cart-dropdown component', () => {
|
|||
test('tax', () => {
|
||||
// Arrange
|
||||
const reference = '#cart-sales-tax';
|
||||
const isExpanded = true;
|
||||
const initialData = { isExpanded };
|
||||
const { wrapper } = getMountedComponent({}, {}, initialData);
|
||||
const { wrapper } = getMountedComponent({}, {}, {});
|
||||
|
||||
// Act
|
||||
const salesTax = wrapper.find(reference);
|
||||
|
|
@ -280,9 +240,7 @@ describe('cart-dropdown component', () => {
|
|||
test('bottom amount due', () => {
|
||||
// Arrange
|
||||
const reference = '#bottom-amount-due';
|
||||
const isExpanded = true;
|
||||
const initialData = { isExpanded };
|
||||
const { wrapper } = getMountedComponent({}, {}, initialData);
|
||||
const { wrapper } = getMountedComponent({}, {}, {});
|
||||
|
||||
// Act
|
||||
const bottomAmountDue = wrapper.find(reference);
|
||||
|
|
@ -295,8 +253,6 @@ describe('cart-dropdown component', () => {
|
|||
test('cart deductible when showDeductibleLineItem is false', () => {
|
||||
// Arrange
|
||||
const reference = '#cart-deductible';
|
||||
const isExpanded = true;
|
||||
const initialData = { isExpanded };
|
||||
const storeData = {
|
||||
order: {
|
||||
currentDeductible: 0,
|
||||
|
|
@ -310,7 +266,7 @@ describe('cart-dropdown component', () => {
|
|||
isClaimRegistrationRequired: true
|
||||
}
|
||||
};
|
||||
const { wrapper } = getMountedComponent(storeData, {}, initialData);
|
||||
const { wrapper } = getMountedComponent(storeData, {}, {});
|
||||
|
||||
// Act
|
||||
const cartDeductible = wrapper.find(reference);
|
||||
|
|
@ -321,8 +277,6 @@ describe('cart-dropdown component', () => {
|
|||
test('cart base price when showDeductibleLineItem is true', () => {
|
||||
// Arrange
|
||||
const reference = '#cart-base-price';
|
||||
const isExpanded = true;
|
||||
const initialData = { isExpanded };
|
||||
const storeData = {
|
||||
order: {
|
||||
insuranceCoverage: {
|
||||
|
|
@ -331,7 +285,7 @@ describe('cart-dropdown component', () => {
|
|||
}
|
||||
}
|
||||
};
|
||||
const { wrapper } = getMountedComponent(storeData, {}, initialData);
|
||||
const { wrapper } = getMountedComponent(storeData, {}, {});
|
||||
|
||||
// Act
|
||||
const cartBasePrice = wrapper.find(reference);
|
||||
|
|
@ -1223,91 +1177,6 @@ describe('cart-dropdown component', () => {
|
|||
expect(result.name).toBe(expectedName);
|
||||
});
|
||||
});
|
||||
describe('packagePrice', () => {
|
||||
test('returns 0 when servicePackageCartItems is empty', () => {
|
||||
// Arrange
|
||||
getPriceOfLineItems.mockImplementation(() => 123);
|
||||
getPackageContents.mockImplementationOnce(() => []);
|
||||
const storeData = {
|
||||
order: {
|
||||
lineItems: {
|
||||
vaps: [
|
||||
{
|
||||
partType: partTypeStrings.REAR_WIPER
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
const { wrapper } = getMountedComponent(storeData);
|
||||
|
||||
// Act
|
||||
const result = wrapper.vm.packagePrice;
|
||||
|
||||
// Assert
|
||||
expect(result).toBe(0);
|
||||
});
|
||||
test('returns expected when servicePackageCartItems not empty', () => {
|
||||
// Arrange
|
||||
const rearPrice = 101;
|
||||
const frontPrice = 9;
|
||||
getPriceOfLineItems.mockImplementation((lineItems) => {
|
||||
if (lineItems.some((item) => item?.partType === partTypeStrings.FRONT_WIPER)) {
|
||||
return frontPrice;
|
||||
}
|
||||
if (lineItems.some((item) => item?.partType === partTypeStrings.REAR_WIPER)) {
|
||||
return rearPrice;
|
||||
}
|
||||
return 1;
|
||||
});
|
||||
getPackageContents.mockImplementationOnce(() => [partTypeStrings.FRONT_WIPER, partTypeStrings.REAR_WIPER]);
|
||||
const storeData = {
|
||||
order: {
|
||||
lineItems: {
|
||||
vaps: [
|
||||
{ partType: partTypeStrings.FRONT_WIPER },
|
||||
{ partType: partTypeStrings.REAR_WIPER }
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
const { wrapper } = getMountedComponent(storeData);
|
||||
const expectedPrice = 110;
|
||||
|
||||
// Act
|
||||
const result = wrapper.vm.packagePrice;
|
||||
|
||||
// Assert
|
||||
expect(result).toBe(expectedPrice);
|
||||
});
|
||||
test('returns expected when servicePackageCartItems has one item', () => {
|
||||
// Arrange
|
||||
const frontPrice = 9;
|
||||
getPriceOfLineItems.mockImplementation((lineItems) => {
|
||||
if (lineItems.some((item) => item?.partType === partTypeStrings.FRONT_WIPER)) {
|
||||
return frontPrice;
|
||||
}
|
||||
return 1;
|
||||
});
|
||||
getPackageContents.mockImplementationOnce(() => [partTypeStrings.FRONT_WIPER, partTypeStrings.REAR_WIPER]);
|
||||
const storeData = {
|
||||
order: {
|
||||
lineItems: {
|
||||
vaps: [
|
||||
{ partType: partTypeStrings.FRONT_WIPER }
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
const { wrapper } = getMountedComponent(storeData);
|
||||
|
||||
// Act
|
||||
const result = wrapper.vm.packagePrice;
|
||||
|
||||
// Assert
|
||||
expect(result).toBe(frontPrice);
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('method', () => {
|
||||
const dollarAmount = '$84.00';
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
<div
|
||||
v-for="(item, i) in nonServicePackageCartItems"
|
||||
:key="i"
|
||||
class="cart-item">
|
||||
class="cart-item non-packaged">
|
||||
<div class="price-row">
|
||||
<span
|
||||
v-if="item.cartItemType === cartItemType.RECYCLE_FEE"
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
<div
|
||||
v-for="(item, i) in servicePackageCartItems"
|
||||
:key="i"
|
||||
class="cart-item">
|
||||
class="cart-item packaged">
|
||||
<div class="price-row">
|
||||
<span>{{ item?.name ?? '' }}</span>
|
||||
<span>{{ formatAmountInDollars(item?.subTotal ?? 0) }}</span>
|
||||
|
|
|
|||
|
|
@ -2,11 +2,10 @@
|
|||
import calendarOptions from '@/constants/calendar-options';
|
||||
|
||||
// Supporting Files
|
||||
import { shallowMount, mount } from '@vue/test-utils';
|
||||
import { shallowMount } from '@vue/test-utils';
|
||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||
import { useMainStore } from '@/store';
|
||||
import addToCalendar from '@/layouts/order-confirmation/add-to-calendar/add-to-calendar.vue';
|
||||
import { createTestingPinia } from '@pinia/testing';
|
||||
|
||||
const appointmentText = 'Appointment content';
|
||||
function setupMocks({ customMountOptions }) {
|
||||
|
|
@ -21,49 +20,6 @@ function setupMocks({ customMountOptions }) {
|
|||
}
|
||||
];
|
||||
const wrapper = shallowMount(addToCalendar, mountOptions);
|
||||
wrapper.vm.$refs.calendarModalQuestion.openModal = jest.fn();
|
||||
return { wrapper };
|
||||
}
|
||||
|
||||
const calendarModalQuestionStub = {
|
||||
render: () => {}
|
||||
};
|
||||
|
||||
const mockMixin = {
|
||||
methods: {
|
||||
getCmsContent: jest.fn().mockImplementation(() => appointmentText)
|
||||
}
|
||||
};
|
||||
|
||||
function getMountedComponent(mainInitialState = {}, initialData = {}, methodToRun = () => {}, mixin = mockMixin) {
|
||||
const mountOptions = getMountOptions({
|
||||
router: {
|
||||
navigate: jest.fn(),
|
||||
navigateToExternalUrl: jest.fn()
|
||||
}
|
||||
});
|
||||
|
||||
mountOptions.global.stubs = {
|
||||
calendarModalQuestion: calendarModalQuestionStub
|
||||
};
|
||||
|
||||
const testingPinia = createTestingPinia({
|
||||
initialState: {
|
||||
main: mainInitialState
|
||||
}
|
||||
});
|
||||
useMainStore(testingPinia);
|
||||
methodToRun();
|
||||
|
||||
mountOptions.global.mixins[0].methods.getSettingValue = jest.fn(() => 'false');
|
||||
mountOptions.global.plugins = [testingPinia];
|
||||
mountOptions.mixins = [mixin];
|
||||
mountOptions.data = () => (
|
||||
initialData
|
||||
);
|
||||
|
||||
const wrapper = shallowMount(addToCalendar, mountOptions);
|
||||
wrapper.vm.$refs.calendarModalQuestion.openModal = jest.fn();
|
||||
return { wrapper };
|
||||
}
|
||||
|
||||
|
|
@ -119,51 +75,8 @@ afterEach(() => {
|
|||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
const sessionStorage = {
|
||||
schedule: {
|
||||
date: '2019-01-01',
|
||||
startTime: '09:00',
|
||||
endTime: '10:00',
|
||||
routeCode: '000'
|
||||
},
|
||||
lineItems: {
|
||||
glassParts: [
|
||||
{
|
||||
partNumber: 'ABC123'
|
||||
}
|
||||
],
|
||||
supportingItems: []
|
||||
},
|
||||
serviceLocation: {
|
||||
address: '',
|
||||
address2: null,
|
||||
city: '',
|
||||
state: 'AZ',
|
||||
appointmentType: 'Inshop',
|
||||
zipCode: '12345',
|
||||
zipCodeCtu: '01234',
|
||||
provider: {
|
||||
providerNumber: '123',
|
||||
address: {
|
||||
streetAddress: 'test1',
|
||||
city: 'test',
|
||||
state: 'AZ',
|
||||
zipCode: '12345',
|
||||
zipCodeCtu: '01234'
|
||||
}
|
||||
}
|
||||
},
|
||||
damage: {
|
||||
isRepair: false
|
||||
},
|
||||
referralNumber: '1234567',
|
||||
payment: {
|
||||
isInsurance: true
|
||||
}
|
||||
};
|
||||
|
||||
describe('Add-to-calendar methods...', () => {
|
||||
test('Add-to-calendar should trigger openModal method', () => {
|
||||
test('Add-to-calendar should trigger open options', async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({
|
||||
customMountOptions: {
|
||||
|
|
@ -183,10 +96,11 @@ describe('Add-to-calendar methods...', () => {
|
|||
});
|
||||
|
||||
// Act
|
||||
wrapper.vm.openCalendarModal();
|
||||
wrapper.vm.openCalendarOptions();
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.$refs.calendarModalQuestion.openModal).toBeCalled();
|
||||
expect(wrapper.vm.$refs.calendarOptions.open).toEqual(true);
|
||||
});
|
||||
|
||||
test('getCalendarData should return expected model value.', () => {
|
||||
|
|
|
|||
|
|
@ -209,12 +209,10 @@ export default {
|
|||
}
|
||||
},
|
||||
openCalendarOptions() {
|
||||
console.log('Opening calendar options');
|
||||
this.calendarOptionsOpen = true;
|
||||
window.addEventListener('click', this.clickListener);
|
||||
},
|
||||
calendarOptionSelected(calendarOptionIndex) {
|
||||
console.log('Selected calendar option:', calendarOptionIndex);
|
||||
this.setCalendarAppointment(this.calendarValues[calendarOptionIndex]);
|
||||
this.calendarOptionsOpen = false;
|
||||
},
|
||||
|
|
@ -255,7 +253,6 @@ export default {
|
|||
download('SafeliteAppointment.ics', calBody);
|
||||
},
|
||||
closeCalendarOptions() {
|
||||
console.log('Closing calendar options');
|
||||
this.calendarOptionsOpen = false;
|
||||
window.removeEventListener('click', this.clickListener);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -7,35 +7,36 @@ describe('calendar-option-selection.vue', () => {
|
|||
const url = 'iCal url';
|
||||
const name = 'iCal';
|
||||
const icon = 'iCal.svg';
|
||||
const url2 = 'Google url';
|
||||
const name2 = 'Google';
|
||||
const icon2 = 'Google.svg';
|
||||
const expectedEmit = [
|
||||
[
|
||||
{
|
||||
url,
|
||||
name,
|
||||
icon
|
||||
}
|
||||
1
|
||||
]
|
||||
];
|
||||
|
||||
const wrapper = shallowMount(calendarModalQuestion, {
|
||||
const wrapper = shallowMount(calendarOptionSelection, {
|
||||
propsData: {
|
||||
calendarOptionsData: [
|
||||
{
|
||||
url,
|
||||
name,
|
||||
icon
|
||||
},
|
||||
{
|
||||
url: url2,
|
||||
name: name2,
|
||||
icon: icon2
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
wrapper.vm.$refs.calendarOptions.closeModal = jest.fn();
|
||||
wrapper.vm.selectedCalendarOption = name;
|
||||
|
||||
// Act
|
||||
wrapper.vm.setSelectedCalendarOption();
|
||||
wrapper.vm.setSelectedCalendarOption(1);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.emitted()['update:modelValue']).toEqual(expectedEmit);
|
||||
expect(wrapper.emitted()['calendar-option-selected']).toEqual(expectedEmit);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ describe('OrderConfirmation.vue', () => {
|
|||
expect(actualEmail).toBe(emailAddress);
|
||||
});
|
||||
});
|
||||
describe('confirmationEmailText', () => {
|
||||
describe('orderConfirmationUpdateAppointmentText', () => {
|
||||
const greaterId = '>';
|
||||
const lessId = '<';
|
||||
test.each([
|
||||
|
|
@ -383,7 +383,7 @@ describe('OrderConfirmation.vue', () => {
|
|||
const { wrapper } = getMountedComponent(initialStore, {}, mockStoreActions);
|
||||
|
||||
// Act
|
||||
const text = wrapper.vm.confirmationEmailText;
|
||||
const text = wrapper.vm.orderConfirmationUpdateAppointmentText;
|
||||
|
||||
// Assert
|
||||
expect(text).toBe(expected);
|
||||
|
|
@ -391,13 +391,13 @@ describe('OrderConfirmation.vue', () => {
|
|||
});
|
||||
describe('appointmentTimeText', () => {
|
||||
test.each([
|
||||
['Between 9 AM - 10 AM', '09:00', '10:00'],
|
||||
['Between 1 PM - 5 PM', '13:00', '17:00'],
|
||||
['Between 8:30 AM - 3 PM', '08:30', '15:00'],
|
||||
['Between 1 AM - 2 AM', '01:00', '02:00'],
|
||||
['Between 12 AM - 2 AM', '00:00', '02:00'],
|
||||
['Between 12 PM - 2 AM', '12:00', '02:00'],
|
||||
['Between 11 PM - 12 AM', '23:00', '00:00']
|
||||
['Your appointment is at 9 AM - 10 AM', '09:00', '10:00'],
|
||||
['Your appointment is at 1 PM - 5 PM', '13:00', '17:00'],
|
||||
['Your appointment is at 8:30 AM - 3 PM', '08:30', '15:00'],
|
||||
['Your appointment is at 1 AM - 2 AM', '01:00', '02:00'],
|
||||
['Your appointment is at 12 AM - 2 AM', '00:00', '02:00'],
|
||||
['Your appointment is at 12 PM - 2 AM', '12:00', '02:00'],
|
||||
['Your appointment is at 11 PM - 12 AM', '23:00', '00:00']
|
||||
])('should return Mobile time in expected format "%p" when start time "%p" and end time "%p"', (expected, startTime, endTime) => {
|
||||
// Arrange
|
||||
const order = deepClone(sessionStorage);
|
||||
|
|
@ -438,12 +438,12 @@ describe('OrderConfirmation.vue', () => {
|
|||
expect(testValue).toEqual('Drop off before 9:30 AM');
|
||||
});
|
||||
test.each([
|
||||
['at 9:00 AM', '09:00', '10:00'],
|
||||
['at 1:00 PM', '13:00', '17:00'],
|
||||
['at 8:30 AM', '08:30', '15:00'],
|
||||
['at 1:00 AM', '01:00', '02:00'],
|
||||
['at 12:00 AM', '00:00', '02:00'],
|
||||
['at 12:00 PM', '12:00', '02:00']
|
||||
['Your appointment is at 9:00 AM', '09:00', '10:00'],
|
||||
['Your appointment is at 1:00 PM', '13:00', '17:00'],
|
||||
['Your appointment is at 8:30 AM', '08:30', '15:00'],
|
||||
['Your appointment is at 1:00 AM', '01:00', '02:00'],
|
||||
['Your appointment is at 12:00 AM', '00:00', '02:00'],
|
||||
['Your appointment is at 12:00 PM', '12:00', '02:00']
|
||||
])('should return In Shop time in expected format "%p" when start time "%p"', (expected, startTime, endTime) => {
|
||||
// Arrange
|
||||
const order = deepClone(sessionStorage);
|
||||
|
|
@ -479,8 +479,8 @@ describe('OrderConfirmation.vue', () => {
|
|||
}
|
||||
}
|
||||
};
|
||||
const expectedServiceLocation = '123 Service Rd., Box 4,<br/> Columbus, OH 12345';
|
||||
const expectedShopLocation = '304 Provider Ln.,<br/> Pittsburg, PA 16001';
|
||||
const expectedServiceLocation = '123 Service Rd., Box 4, Columbus, OH 12345';
|
||||
const expectedShopLocation = '304 Provider Ln., Pittsburg, PA 16001';
|
||||
test.each([
|
||||
AppointmentTypeStrings.MOBILE,
|
||||
AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP
|
||||
|
|
@ -554,7 +554,7 @@ describe('OrderConfirmation.vue', () => {
|
|||
useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => order);
|
||||
};
|
||||
const { wrapper } = getMountedComponent({}, {}, mockStoreActions);
|
||||
const expected = '123 Service Rd., Box 4,<br/> Columbus, OH 12345';
|
||||
const expected = '123 Service Rd., Box 4, Columbus, OH 12345';
|
||||
|
||||
// Act
|
||||
const text = wrapper.vm.serviceLocationFullAddress;
|
||||
|
|
@ -568,7 +568,7 @@ describe('OrderConfirmation.vue', () => {
|
|||
useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => order);
|
||||
};
|
||||
const { wrapper } = getMountedComponent({}, {}, mockStoreActions);
|
||||
const expected = ', Box 4,<br/> Columbus, OH 12345';
|
||||
const expected = ', Box 4, Columbus, OH 12345';
|
||||
|
||||
// Act
|
||||
const text = wrapper.vm.serviceLocationFullAddress;
|
||||
|
|
@ -582,7 +582,7 @@ describe('OrderConfirmation.vue', () => {
|
|||
useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => order);
|
||||
};
|
||||
const { wrapper } = getMountedComponent({}, {}, mockStoreActions);
|
||||
const expected = '123 Service Rd., <br/> Columbus, OH 12345';
|
||||
const expected = '123 Service Rd., Columbus, OH 12345';
|
||||
|
||||
// Act
|
||||
const text = wrapper.vm.serviceLocationFullAddress;
|
||||
|
|
@ -596,7 +596,7 @@ describe('OrderConfirmation.vue', () => {
|
|||
useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => order);
|
||||
};
|
||||
const { wrapper } = getMountedComponent({}, {}, mockStoreActions);
|
||||
const expected = '123 Service Rd., Box 4,<br/> , OH 12345';
|
||||
const expected = '123 Service Rd., Box 4, , OH 12345';
|
||||
|
||||
// Act
|
||||
const text = wrapper.vm.serviceLocationFullAddress;
|
||||
|
|
@ -610,7 +610,7 @@ describe('OrderConfirmation.vue', () => {
|
|||
useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => order);
|
||||
};
|
||||
const { wrapper } = getMountedComponent({}, {}, mockStoreActions);
|
||||
const expected = '123 Service Rd., Box 4,<br/> Columbus, 12345';
|
||||
const expected = '123 Service Rd., Box 4, Columbus, 12345';
|
||||
|
||||
// Act
|
||||
const text = wrapper.vm.serviceLocationFullAddress;
|
||||
|
|
@ -624,7 +624,7 @@ describe('OrderConfirmation.vue', () => {
|
|||
useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => order);
|
||||
};
|
||||
const { wrapper } = getMountedComponent({}, {}, mockStoreActions);
|
||||
const expected = '123 Service Rd., Box 4,<br/> Columbus, OH ';
|
||||
const expected = '123 Service Rd., Box 4, Columbus, OH ';
|
||||
|
||||
// Act
|
||||
const text = wrapper.vm.serviceLocationFullAddress;
|
||||
|
|
@ -642,7 +642,7 @@ describe('OrderConfirmation.vue', () => {
|
|||
useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => order);
|
||||
};
|
||||
const { wrapper } = getMountedComponent({}, {}, mockStoreActions);
|
||||
const expected = ', <br/> , ';
|
||||
const expected = ', , ';
|
||||
|
||||
// Act
|
||||
const text = wrapper.vm.serviceLocationFullAddress;
|
||||
|
|
@ -675,7 +675,7 @@ describe('OrderConfirmation.vue', () => {
|
|||
useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => order);
|
||||
};
|
||||
const { wrapper } = getMountedComponent({}, {}, mockStoreActions);
|
||||
const expected = '304 Provider Ln.,<br/> Pittsburg, PA 16001';
|
||||
const expected = '304 Provider Ln., Pittsburg, PA 16001';
|
||||
|
||||
// Act
|
||||
const text = wrapper.vm.providerFullAddress;
|
||||
|
|
@ -703,7 +703,7 @@ describe('OrderConfirmation.vue', () => {
|
|||
useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => order);
|
||||
};
|
||||
const { wrapper } = getMountedComponent({}, {}, mockStoreActions);
|
||||
const expected = '304 Provider Ln.,<br/> , PA 16001';
|
||||
const expected = '304 Provider Ln., , PA 16001';
|
||||
|
||||
// Act
|
||||
const text = wrapper.vm.providerFullAddress;
|
||||
|
|
@ -717,7 +717,7 @@ describe('OrderConfirmation.vue', () => {
|
|||
useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => order);
|
||||
};
|
||||
const { wrapper } = getMountedComponent({}, {}, mockStoreActions);
|
||||
const expected = '304 Provider Ln.,<br/> Pittsburg, 16001';
|
||||
const expected = '304 Provider Ln., Pittsburg, 16001';
|
||||
|
||||
// Act
|
||||
const text = wrapper.vm.providerFullAddress;
|
||||
|
|
@ -731,7 +731,7 @@ describe('OrderConfirmation.vue', () => {
|
|||
useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => order);
|
||||
};
|
||||
const { wrapper } = getMountedComponent({}, {}, mockStoreActions);
|
||||
const expected = '304 Provider Ln.,<br/> Pittsburg, PA ';
|
||||
const expected = '304 Provider Ln., Pittsburg, PA ';
|
||||
|
||||
// Act
|
||||
const text = wrapper.vm.providerFullAddress;
|
||||
|
|
@ -956,9 +956,9 @@ describe('OrderConfirmation.vue', () => {
|
|||
describe('Methods', () => {
|
||||
describe('formatDate', () => {
|
||||
test.each([
|
||||
['Wednesday, April 22', '2020-04-22'],
|
||||
['Thursday, February 1', '2018-02-01'],
|
||||
['Wednesday, December 30', '2026-12-30']
|
||||
['Wednesday, April 22, 2020', '2020-04-22'],
|
||||
['Thursday, February 1, 2018', '2018-02-01'],
|
||||
['Wednesday, December 30, 2026', '2026-12-30']
|
||||
])('returns %p given %p', (expected, date) => {
|
||||
// Arrange
|
||||
const order = deepClone(sessionStorage);
|
||||
|
|
|
|||
|
|
@ -422,7 +422,7 @@ export default {
|
|||
|
||||
// settleTenderAmount always shows 0 via localhost or dev.
|
||||
// Temporarily set return true to see cart in localhost or dev environment
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
displayWipers() {
|
||||
const hasWiperPart = this.submittedOrder.lineItems.vaps.some((part) => part.partType.toLowerCase().includes('wiper'));
|
||||
|
|
|
|||
Loading…
Reference in a new issue