Merge pull request #614 from Safelite/feature/digital/SSR-1125
SSR-1125 Update Phone Numbers
This commit is contained in:
commit
b3648c8ab4
12 changed files with 168 additions and 64 deletions
|
|
@ -160,14 +160,16 @@ describe('contactDetails.vue', () => {
|
||||||
const firstName = getRandomString(4, 15);
|
const firstName = getRandomString(4, 15);
|
||||||
const lastName = getRandomString(4, 15);
|
const lastName = getRandomString(4, 15);
|
||||||
const emailAddress = getRandomString(10, 20);
|
const emailAddress = getRandomString(10, 20);
|
||||||
const phoneNumber = getRandomInt(1000000000, 9999999999);
|
const servicePhone = getRandomInt(1000000000, 9999999999).toString();
|
||||||
const mainInitialState = {
|
const mainInitialState = {
|
||||||
order: {
|
order: {
|
||||||
customer: {
|
customer: {
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress
|
||||||
phoneNumber
|
},
|
||||||
|
contactInfo: {
|
||||||
|
servicePhone
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -185,7 +187,7 @@ describe('contactDetails.vue', () => {
|
||||||
expect(wrapper.vm.firstName).toBe(firstName);
|
expect(wrapper.vm.firstName).toBe(firstName);
|
||||||
expect(wrapper.vm.lastName).toBe(lastName);
|
expect(wrapper.vm.lastName).toBe(lastName);
|
||||||
expect(wrapper.vm.emailAddress).toBe(emailAddress);
|
expect(wrapper.vm.emailAddress).toBe(emailAddress);
|
||||||
expect(wrapper.vm.phoneNumber).toBe(phoneNumber);
|
expect(wrapper.vm.phoneNumber).toBe(servicePhone);
|
||||||
});
|
});
|
||||||
test('Mock store with contact info yields expected data', () => {
|
test('Mock store with contact info yields expected data', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
@ -199,7 +201,7 @@ describe('contactDetails.vue', () => {
|
||||||
firstName: getRandomString(4, 15),
|
firstName: getRandomString(4, 15),
|
||||||
lastName: getRandomString(4, 15),
|
lastName: getRandomString(4, 15),
|
||||||
emailAddress: getRandomString(10, 20),
|
emailAddress: getRandomString(10, 20),
|
||||||
phoneNumber: getRandomInt(1000000000, 9999999999),
|
servicePhone: getRandomInt(1000000000, 9999999999),
|
||||||
requestTextUpdates: getRandomBoolean(),
|
requestTextUpdates: getRandomBoolean(),
|
||||||
notesForTechnician: getRandomString(50, 100)
|
notesForTechnician: getRandomString(50, 100)
|
||||||
};
|
};
|
||||||
|
|
@ -224,7 +226,7 @@ describe('contactDetails.vue', () => {
|
||||||
expect(wrapper.vm.firstName).toBe(contactInfo.firstName);
|
expect(wrapper.vm.firstName).toBe(contactInfo.firstName);
|
||||||
expect(wrapper.vm.lastName).toBe(contactInfo.lastName);
|
expect(wrapper.vm.lastName).toBe(contactInfo.lastName);
|
||||||
expect(wrapper.vm.emailAddress).toBe(contactInfo.emailAddress);
|
expect(wrapper.vm.emailAddress).toBe(contactInfo.emailAddress);
|
||||||
expect(wrapper.vm.phoneNumber).toBe(contactInfo.phoneNumber);
|
expect(wrapper.vm.phoneNumber).toBe(contactInfo.servicePhone);
|
||||||
expect(wrapper.vm.requestTextUpdates).toBe(contactInfo.requestTextUpdates);
|
expect(wrapper.vm.requestTextUpdates).toBe(contactInfo.requestTextUpdates);
|
||||||
expect(wrapper.vm.notesForTechnician).toBe(contactInfo.notesForTechnician);
|
expect(wrapper.vm.notesForTechnician).toBe(contactInfo.notesForTechnician);
|
||||||
});
|
});
|
||||||
|
|
@ -315,7 +317,7 @@ describe('contactDetails.vue', () => {
|
||||||
const firstName = getRandomString(4, 15);
|
const firstName = getRandomString(4, 15);
|
||||||
const lastName = getRandomString(4, 15);
|
const lastName = getRandomString(4, 15);
|
||||||
const emailAddress = getRandomString(10, 20);
|
const emailAddress = getRandomString(10, 20);
|
||||||
const phoneNumber = getRandomInt(1000000000, 9999999999);
|
const phoneNumber = getRandomInt(1000000000, 9999999999).toString();
|
||||||
const requestTextUpdates = getRandomBoolean();
|
const requestTextUpdates = getRandomBoolean();
|
||||||
const notesForTechnician = getRandomString(1, 100);
|
const notesForTechnician = getRandomString(1, 100);
|
||||||
wrapper.setData({
|
wrapper.setData({
|
||||||
|
|
@ -335,11 +337,60 @@ describe('contactDetails.vue', () => {
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
phoneNumber,
|
|
||||||
requestTextUpdates,
|
requestTextUpdates,
|
||||||
notesForTechnician
|
notesForTechnician
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Forward button click updates phone numbers request text updates', () => {
|
||||||
|
// Arrange
|
||||||
|
const mountOptions = getMountOptions({
|
||||||
|
router: {
|
||||||
|
navigate: jest.fn()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const wrapper = shallowMount(contactDetails, mountOptions);
|
||||||
|
const phoneNumber = getRandomInt(1000000000, 9999999999).toString();
|
||||||
|
const requestTextUpdates = true;
|
||||||
|
wrapper.setData({
|
||||||
|
phoneNumber,
|
||||||
|
requestTextUpdates
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(useMainStore().updatePhoneNumbers).toHaveBeenCalledWith({
|
||||||
|
service: phoneNumber,
|
||||||
|
alternative: phoneNumber
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Forward button click updates phone numbers dot not request text updates', () => {
|
||||||
|
// Arrange
|
||||||
|
const mountOptions = getMountOptions({
|
||||||
|
router: {
|
||||||
|
navigate: jest.fn()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const wrapper = shallowMount(contactDetails, mountOptions);
|
||||||
|
const phoneNumber = getRandomInt(1000000000, 9999999999).toString();
|
||||||
|
const requestTextUpdates = false;
|
||||||
|
wrapper.setData({
|
||||||
|
phoneNumber,
|
||||||
|
requestTextUpdates
|
||||||
|
});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(useMainStore().updatePhoneNumbers).toHaveBeenCalledWith({
|
||||||
|
home: phoneNumber,
|
||||||
|
service: phoneNumber
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Mocked store with no contact info yields expected data', () => {
|
test('Mocked store with no contact info yields expected data', () => {
|
||||||
|
|
@ -349,20 +400,19 @@ describe('contactDetails.vue', () => {
|
||||||
const firstName = getRandomString(4, 15);
|
const firstName = getRandomString(4, 15);
|
||||||
const lastName = getRandomString(4, 15);
|
const lastName = getRandomString(4, 15);
|
||||||
const emailAddress = getRandomString(10, 20);
|
const emailAddress = getRandomString(10, 20);
|
||||||
const phoneNumber = getRandomInt(1000000000, 9999999999);
|
const servicePhone = getRandomInt(1000000000, 9999999999);
|
||||||
const mainInitialState = {
|
const mainInitialState = {
|
||||||
order: {
|
order: {
|
||||||
customer: {
|
customer: {
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress
|
||||||
phoneNumber
|
|
||||||
},
|
},
|
||||||
contactInfo: {
|
contactInfo: {
|
||||||
firstName: null,
|
firstName: null,
|
||||||
lastName: null,
|
lastName: null,
|
||||||
emailAddress: null,
|
emailAddress: null,
|
||||||
phoneNumber: null,
|
servicePhone,
|
||||||
requestTextUpdates: null,
|
requestTextUpdates: null,
|
||||||
notesForTechnician: null
|
notesForTechnician: null
|
||||||
}
|
}
|
||||||
|
|
@ -382,7 +432,7 @@ describe('contactDetails.vue', () => {
|
||||||
expect(wrapper.vm.firstName).toBe(firstName);
|
expect(wrapper.vm.firstName).toBe(firstName);
|
||||||
expect(wrapper.vm.lastName).toBe(lastName);
|
expect(wrapper.vm.lastName).toBe(lastName);
|
||||||
expect(wrapper.vm.emailAddress).toBe(emailAddress);
|
expect(wrapper.vm.emailAddress).toBe(emailAddress);
|
||||||
expect(wrapper.vm.phoneNumber).toBe(phoneNumber);
|
expect(wrapper.vm.phoneNumber).toBe(servicePhone);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Mock store with contact info yields expected data', () => {
|
test('Mock store with contact info yields expected data', () => {
|
||||||
|
|
@ -397,7 +447,7 @@ describe('contactDetails.vue', () => {
|
||||||
firstName: getRandomString(4, 15),
|
firstName: getRandomString(4, 15),
|
||||||
lastName: getRandomString(4, 15),
|
lastName: getRandomString(4, 15),
|
||||||
emailAddress: getRandomString(10, 20),
|
emailAddress: getRandomString(10, 20),
|
||||||
phoneNumber: getRandomInt(1000000000, 9999999999),
|
servicePhone: getRandomInt(1000000000, 9999999999),
|
||||||
requestTextUpdates: getRandomBoolean(),
|
requestTextUpdates: getRandomBoolean(),
|
||||||
notesForTechnician: getRandomString(50, 100)
|
notesForTechnician: getRandomString(50, 100)
|
||||||
};
|
};
|
||||||
|
|
@ -422,7 +472,7 @@ describe('contactDetails.vue', () => {
|
||||||
expect(wrapper.vm.firstName).toBe(contactInfo.firstName);
|
expect(wrapper.vm.firstName).toBe(contactInfo.firstName);
|
||||||
expect(wrapper.vm.lastName).toBe(contactInfo.lastName);
|
expect(wrapper.vm.lastName).toBe(contactInfo.lastName);
|
||||||
expect(wrapper.vm.emailAddress).toBe(contactInfo.emailAddress);
|
expect(wrapper.vm.emailAddress).toBe(contactInfo.emailAddress);
|
||||||
expect(wrapper.vm.phoneNumber).toBe(contactInfo.phoneNumber);
|
expect(wrapper.vm.phoneNumber).toBe(contactInfo.servicePhone);
|
||||||
expect(wrapper.vm.requestTextUpdates).toBe(contactInfo.requestTextUpdates);
|
expect(wrapper.vm.requestTextUpdates).toBe(contactInfo.requestTextUpdates);
|
||||||
expect(wrapper.vm.notesForTechnician).toBe(contactInfo.notesForTechnician);
|
expect(wrapper.vm.notesForTechnician).toBe(contactInfo.notesForTechnician);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -139,14 +139,14 @@ export default {
|
||||||
const { firstName,
|
const { firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
phoneNumber,
|
servicePhone,
|
||||||
requestTextUpdates,
|
requestTextUpdates,
|
||||||
notesForTechnician } = useMainStore().contactInfo;
|
notesForTechnician } = useMainStore().contactInfo;
|
||||||
return {
|
return {
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
phoneNumber,
|
phoneNumber: servicePhone,
|
||||||
requestTextUpdates,
|
requestTextUpdates,
|
||||||
notesForTechnician,
|
notesForTechnician,
|
||||||
widget: {
|
widget: {
|
||||||
|
|
@ -196,11 +196,23 @@ export default {
|
||||||
firstName: this.firstName,
|
firstName: this.firstName,
|
||||||
lastName: this.lastName,
|
lastName: this.lastName,
|
||||||
emailAddress: this.emailAddress,
|
emailAddress: this.emailAddress,
|
||||||
phoneNumber: this.phoneNumber,
|
|
||||||
requestTextUpdates: this.requestTextUpdates,
|
requestTextUpdates: this.requestTextUpdates,
|
||||||
notesForTechnician: this.notesForTechnician
|
notesForTechnician: this.notesForTechnician
|
||||||
};
|
};
|
||||||
useMainStore().updateContactInfo(contactInfo);
|
useMainStore().updateContactInfo(contactInfo);
|
||||||
|
|
||||||
|
if (this.requestTextUpdates) {
|
||||||
|
useMainStore().updatePhoneNumbers({
|
||||||
|
service: this.phoneNumber,
|
||||||
|
alternative: this.phoneNumber
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
useMainStore().updatePhoneNumbers({
|
||||||
|
home: this.phoneNumber,
|
||||||
|
service: this.phoneNumber
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const scenario = useMainStore().order.serviceLocation.IsSafeliteProvider === false
|
const scenario = useMainStore().order.serviceLocation.IsSafeliteProvider === false
|
||||||
? this.navigationScenarios.CLICKED_FORWARD_WITH_NON_SAFELITE_SHOP
|
? this.navigationScenarios.CLICKED_FORWARD_WITH_NON_SAFELITE_SHOP
|
||||||
: this.navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE_SHOP;
|
: this.navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE_SHOP;
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ const initialStore = {
|
||||||
contactInfo: {
|
contactInfo: {
|
||||||
firstName: 'Test',
|
firstName: 'Test',
|
||||||
lastName: 'Test',
|
lastName: 'Test',
|
||||||
phoneNumber: '111-111-1111',
|
servicePhone: '111-111-1111',
|
||||||
emailAddress: 'test@email.com'
|
emailAddress: 'test@email.com'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -318,7 +318,7 @@ export default {
|
||||||
const contactInfoReqs = !!(
|
const contactInfoReqs = !!(
|
||||||
contactInfo.firstName
|
contactInfo.firstName
|
||||||
&& contactInfo.lastName
|
&& contactInfo.lastName
|
||||||
&& contactInfo.phoneNumber
|
&& contactInfo.servicePhone
|
||||||
&& contactInfo.emailAddress
|
&& contactInfo.emailAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ describe('payment-page.vue', () => {
|
||||||
firstName: 'first',
|
firstName: 'first',
|
||||||
lastName: 'last',
|
lastName: 'last',
|
||||||
emailAddress: 'builddigitaltest@safelite.com',
|
emailAddress: 'builddigitaltest@safelite.com',
|
||||||
phoneNumber: '555-555-5555'
|
servicePhone: '555-555-5555'
|
||||||
},
|
},
|
||||||
damage: {
|
damage: {
|
||||||
isRepair: false,
|
isRepair: false,
|
||||||
|
|
|
||||||
|
|
@ -500,7 +500,7 @@ export default {
|
||||||
zipCode: this.getZipCode(),
|
zipCode: this.getZipCode(),
|
||||||
firstName: useMainStore().order.contactInfo.firstName,
|
firstName: useMainStore().order.contactInfo.firstName,
|
||||||
lastName: useMainStore().order.contactInfo.lastName,
|
lastName: useMainStore().order.contactInfo.lastName,
|
||||||
phoneNumber: useMainStore().order.contactInfo.phoneNumber,
|
phoneNumber: useMainStore().order.contactInfo.servicePhone,
|
||||||
ctu: useMainStore().order.serviceLocation.zipCodeCtu,
|
ctu: useMainStore().order.serviceLocation.zipCodeCtu,
|
||||||
referralCorrelationId: useMainStore().order.referralCorrelationId,
|
referralCorrelationId: useMainStore().order.referralCorrelationId,
|
||||||
workOrderNumber: this.getWorkOrderNumber(),
|
workOrderNumber: this.getWorkOrderNumber(),
|
||||||
|
|
@ -597,7 +597,7 @@ export default {
|
||||||
const contactInfoReqs = !!(
|
const contactInfoReqs = !!(
|
||||||
contactInfo.firstName
|
contactInfo.firstName
|
||||||
&& contactInfo.lastName
|
&& contactInfo.lastName
|
||||||
&& contactInfo.phoneNumber
|
&& contactInfo.servicePhone
|
||||||
&& contactInfo.emailAddress
|
&& contactInfo.emailAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,14 +35,14 @@ describe('contact-details-drawer', () => {
|
||||||
const firstName = 'Frederick';
|
const firstName = 'Frederick';
|
||||||
const lastName = 'Taylor';
|
const lastName = 'Taylor';
|
||||||
const emailAddress = 'fred.tay@gmail.com';
|
const emailAddress = 'fred.tay@gmail.com';
|
||||||
const phoneNumber = '606-009-2943';
|
const servicePhone = '606-009-2943';
|
||||||
const mainInitialState = {
|
const mainInitialState = {
|
||||||
order: {
|
order: {
|
||||||
contactInfo: {
|
contactInfo: {
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
phoneNumber
|
servicePhone
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -81,7 +81,7 @@ describe('contact-details-drawer', () => {
|
||||||
firstName: 'Frederick',
|
firstName: 'Frederick',
|
||||||
lastName: 'Taylor',
|
lastName: 'Taylor',
|
||||||
emailAddress: 'fred.tay@gmail.com',
|
emailAddress: 'fred.tay@gmail.com',
|
||||||
phoneNumber: '606-009-2943'
|
servicePhone: '606-009-2943'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -96,7 +96,9 @@ describe('contact-details-drawer', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.emitted()['update-contact-details']).toBeTruthy();
|
expect(wrapper.emitted()['update-contact-details']).toBeTruthy();
|
||||||
expect(useMainStore().updateContactInfo).toBeCalledTimes(1);
|
expect(useMainStore().updateContactInfo).toBeCalledTimes(1);
|
||||||
expect(useMainStore().updateContactInfo).toBeCalledWith({ firstName, lastName, emailAddress, phoneNumber });
|
expect(useMainStore().updateContactInfo).toBeCalledWith({ firstName, lastName, emailAddress });
|
||||||
|
expect(useMainStore().updatePhoneNumbers).toBeCalledTimes(1);
|
||||||
|
expect(useMainStore().updatePhoneNumbers).toBeCalledWith({ home: phoneNumber, service: phoneNumber });
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -67,13 +67,13 @@ export default {
|
||||||
const { firstName,
|
const { firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
phoneNumber } = useMainStore().contactInfo;
|
servicePhone } = useMainStore().contactInfo;
|
||||||
return {
|
return {
|
||||||
isModalOpened: false,
|
isModalOpened: false,
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
phoneNumber,
|
phoneNumber: servicePhone,
|
||||||
widget: {
|
widget: {
|
||||||
title: 'ContactDetailsDrawerHeaderWidget',
|
title: 'ContactDetailsDrawerHeaderWidget',
|
||||||
firstNameQuestion: 'FirstNameQuestionWidget',
|
firstNameQuestion: 'FirstNameQuestionWidget',
|
||||||
|
|
@ -119,21 +119,24 @@ export default {
|
||||||
const contactInfo = {
|
const contactInfo = {
|
||||||
firstName: this.firstName,
|
firstName: this.firstName,
|
||||||
lastName: this.lastName,
|
lastName: this.lastName,
|
||||||
emailAddress: this.emailAddress,
|
emailAddress: this.emailAddress
|
||||||
phoneNumber: this.phoneNumber
|
|
||||||
};
|
};
|
||||||
useMainStore().updateContactInfo(contactInfo);
|
useMainStore().updateContactInfo(contactInfo);
|
||||||
|
useMainStore().updatePhoneNumbers({
|
||||||
|
home: this.phoneNumber,
|
||||||
|
service: this.phoneNumber
|
||||||
|
});
|
||||||
this.$emit('update-contact-details');
|
this.$emit('update-contact-details');
|
||||||
},
|
},
|
||||||
resetFormValues() {
|
resetFormValues() {
|
||||||
const { firstName,
|
const { firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
phoneNumber } = useMainStore().contactInfo;
|
servicePhone } = useMainStore().contactInfo;
|
||||||
this.firstName = firstName;
|
this.firstName = firstName;
|
||||||
this.lastName = lastName;
|
this.lastName = lastName;
|
||||||
this.emailAddress = emailAddress;
|
this.emailAddress = emailAddress;
|
||||||
this.phoneNumber = phoneNumber;
|
this.phoneNumber = servicePhone;
|
||||||
},
|
},
|
||||||
openModal() {
|
openModal() {
|
||||||
this.modal.openModal();
|
this.modal.openModal();
|
||||||
|
|
|
||||||
|
|
@ -499,14 +499,14 @@ describe('tpa-submit', () => {
|
||||||
const firstName = 'Jones';
|
const firstName = 'Jones';
|
||||||
const lastName = 'Eddison';
|
const lastName = 'Eddison';
|
||||||
const emailAddress = 'myname@gmail.com';
|
const emailAddress = 'myname@gmail.com';
|
||||||
const phoneNumber = '0001112222';
|
const servicePhone = '0001112222';
|
||||||
const initialStore = {
|
const initialStore = {
|
||||||
order: {
|
order: {
|
||||||
contactInfo: {
|
contactInfo: {
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
phoneNumber
|
servicePhone
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -514,7 +514,7 @@ describe('tpa-submit', () => {
|
||||||
const expectedLine1 = 'Jones Eddison';
|
const expectedLine1 = 'Jones Eddison';
|
||||||
const expectedLine2 = emailAddress;
|
const expectedLine2 = emailAddress;
|
||||||
const expectedLine3 = 'some value returned';
|
const expectedLine3 = 'some value returned';
|
||||||
toDisplayPhoneNumber.mockImplementation((number) => (number === phoneNumber ? expectedLine3 : ''));
|
toDisplayPhoneNumber.mockImplementation((number) => (number === servicePhone ? expectedLine3 : ''));
|
||||||
const contactInfoSectionIndex = 3;
|
const contactInfoSectionIndex = 3;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -530,7 +530,7 @@ describe('tpa-submit', () => {
|
||||||
expect(contactInfoSection.lines[0]).toBe(expectedLine1);
|
expect(contactInfoSection.lines[0]).toBe(expectedLine1);
|
||||||
expect(contactInfoSection.lines[1]).toBe(expectedLine2);
|
expect(contactInfoSection.lines[1]).toBe(expectedLine2);
|
||||||
expect(contactInfoSection.lines[2]).toBe(expectedLine3);
|
expect(contactInfoSection.lines[2]).toBe(expectedLine3);
|
||||||
expect(toDisplayPhoneNumber).toHaveBeenCalledWith(phoneNumber);
|
expect(toDisplayPhoneNumber).toHaveBeenCalledWith(servicePhone);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('computed', () => {
|
describe('computed', () => {
|
||||||
|
|
|
||||||
|
|
@ -236,11 +236,11 @@ export default {
|
||||||
return [toTitleCase(this.companyName ?? ''), displayAddress, displayPhoneNumber];
|
return [toTitleCase(this.companyName ?? ''), displayAddress, displayPhoneNumber];
|
||||||
},
|
},
|
||||||
getContactInfoLines() {
|
getContactInfoLines() {
|
||||||
const { firstName, lastName, emailAddress, phoneNumber } = useMainStore().contactInfo;
|
const { firstName, lastName, emailAddress, servicePhone } = useMainStore().contactInfo;
|
||||||
return [
|
return [
|
||||||
`${firstName} ${lastName}`,
|
`${firstName} ${lastName}`,
|
||||||
emailAddress ?? '',
|
emailAddress ?? '',
|
||||||
toDisplayPhoneNumber(phoneNumber)
|
toDisplayPhoneNumber(servicePhone)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import {
|
||||||
} from '@/helpers/policy-vehicle-helper';
|
} from '@/helpers/policy-vehicle-helper';
|
||||||
import partTypeStrings from '@/constants/part-type-strings';
|
import partTypeStrings from '@/constants/part-type-strings';
|
||||||
import bailoutMessage from '@/constants/bailoutMessage';
|
import bailoutMessage from '@/constants/bailoutMessage';
|
||||||
import bailoutCode from "@/constants/bailoutCode";
|
import bailoutCode from '@/constants/bailoutCode';
|
||||||
|
|
||||||
const storeId = 'main';
|
const storeId = 'main';
|
||||||
|
|
||||||
|
|
@ -119,8 +119,7 @@ export const getDefaultState = () => ({
|
||||||
},
|
},
|
||||||
firstName: null,
|
firstName: null,
|
||||||
lastName: null,
|
lastName: null,
|
||||||
emailAddress: null,
|
emailAddress: null
|
||||||
phoneNumber: null
|
|
||||||
},
|
},
|
||||||
serviceLocation: {
|
serviceLocation: {
|
||||||
address: null,
|
address: null,
|
||||||
|
|
@ -182,7 +181,9 @@ export const getDefaultState = () => ({
|
||||||
firstName: null,
|
firstName: null,
|
||||||
lastName: null,
|
lastName: null,
|
||||||
emailAddress: null,
|
emailAddress: null,
|
||||||
phoneNumber: null,
|
homePhone: null,
|
||||||
|
alternativePhone: null,
|
||||||
|
servicePhone: null,
|
||||||
requestTextUpdates: false,
|
requestTextUpdates: false,
|
||||||
notesForTechnician: ''
|
notesForTechnician: ''
|
||||||
},
|
},
|
||||||
|
|
@ -308,7 +309,9 @@ export const useMainStore = defineStore({
|
||||||
firstName: s.order.contactInfo.firstName ?? s.order.customer.firstName,
|
firstName: s.order.contactInfo.firstName ?? s.order.customer.firstName,
|
||||||
lastName: s.order.contactInfo.lastName ?? s.order.customer.lastName,
|
lastName: s.order.contactInfo.lastName ?? s.order.customer.lastName,
|
||||||
emailAddress: s.order.contactInfo.emailAddress ?? s.order.customer.emailAddress,
|
emailAddress: s.order.contactInfo.emailAddress ?? s.order.customer.emailAddress,
|
||||||
phoneNumber: s.order.contactInfo.phoneNumber ?? s.order.customer.phoneNumber,
|
homePhone: s.order.contactInfo.homePhone,
|
||||||
|
alternativePhone: s.order.contactInfo.alternativePhone,
|
||||||
|
servicePhone: s.order.contactInfo.servicePhone,
|
||||||
requestTextUpdates: s.order.contactInfo.requestTextUpdates ?? false,
|
requestTextUpdates: s.order.contactInfo.requestTextUpdates ?? false,
|
||||||
notesForTechnician: s.order.contactInfo.notesForTechnician
|
notesForTechnician: s.order.contactInfo.notesForTechnician
|
||||||
}),
|
}),
|
||||||
|
|
@ -554,7 +557,7 @@ export const useMainStore = defineStore({
|
||||||
country: 'US' // TODO set from store
|
country: 'US' // TODO set from store
|
||||||
},
|
},
|
||||||
homePhone: {
|
homePhone: {
|
||||||
number: this.order.customer.phoneNumber?.replaceAll(nonNumberCharRegex, '') ?? ''
|
number: this.order.customerInfo?.homePhone?.replaceAll(nonNumberCharRegex, '') ?? ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
driver: {
|
driver: {
|
||||||
|
|
@ -1204,7 +1207,7 @@ export const useMainStore = defineStore({
|
||||||
policyHolder: {
|
policyHolder: {
|
||||||
policyFirstName: customer.firstName,
|
policyFirstName: customer.firstName,
|
||||||
policyLastName: customer.lastName,
|
policyLastName: customer.lastName,
|
||||||
policyPhoneNumber: customer.phoneNumber,
|
policyPhoneNumber: contactInfo.servicePhone,
|
||||||
policyEmail: customer.emailAddress,
|
policyEmail: customer.emailAddress,
|
||||||
policyState: customer.address.state
|
policyState: customer.address.state
|
||||||
},
|
},
|
||||||
|
|
@ -1228,8 +1231,10 @@ export const useMainStore = defineStore({
|
||||||
emailAddress: contactInfo.emailAddress || customer.emailAddress,
|
emailAddress: contactInfo.emailAddress || customer.emailAddress,
|
||||||
firstName: contactInfo.firstName || customer.firstName,
|
firstName: contactInfo.firstName || customer.firstName,
|
||||||
lastName: contactInfo.lastName || customer.lastName,
|
lastName: contactInfo.lastName || customer.lastName,
|
||||||
phoneNumber: contactInfo.phoneNumber,
|
homePhone: contactInfo.homePhone,
|
||||||
optInSms: contactInfo.requestTextUpdates ?? false
|
servicePhone: contactInfo.servicePhone,
|
||||||
|
alternativePhone: contactInfo.alternativePhone,
|
||||||
|
isSmsOptIn: contactInfo.requestTextUpdates ?? false
|
||||||
},
|
},
|
||||||
lineItems: {
|
lineItems: {
|
||||||
glassParts: lineItems.glassParts,
|
glassParts: lineItems.glassParts,
|
||||||
|
|
@ -1325,7 +1330,6 @@ export const useMainStore = defineStore({
|
||||||
order.customer.emailAddress = data.customer?.emailAddress;
|
order.customer.emailAddress = data.customer?.emailAddress;
|
||||||
order.customer.firstName = data.customer?.firstName;
|
order.customer.firstName = data.customer?.firstName;
|
||||||
order.customer.lastName = data.customer?.lastName;
|
order.customer.lastName = data.customer?.lastName;
|
||||||
order.customer.phoneNumber = data?.customer?.phoneNumber;
|
|
||||||
|
|
||||||
order.customer.address.streetAddress = data.customer?.address?.streetAddress;
|
order.customer.address.streetAddress = data.customer?.address?.streetAddress;
|
||||||
order.customer.address.streetAddress2 = data.customer?.address?.streetAddress2;
|
order.customer.address.streetAddress2 = data.customer?.address?.streetAddress2;
|
||||||
|
|
@ -1336,7 +1340,8 @@ export const useMainStore = defineStore({
|
||||||
order.contactInfo.firstName = data?.customer?.firstName;
|
order.contactInfo.firstName = data?.customer?.firstName;
|
||||||
order.contactInfo.lastName = data?.customer?.lastName;
|
order.contactInfo.lastName = data?.customer?.lastName;
|
||||||
order.contactInfo.emailAddress = data?.customer?.emailAddress;
|
order.contactInfo.emailAddress = data?.customer?.emailAddress;
|
||||||
order.contactInfo.phoneNumber = data?.customer?.phoneNumber;
|
order.contactInfo.homePhone = data?.customer?.phoneNumber;
|
||||||
|
order.contactInfo.servicephone = data?.customer?.phoneNumber;
|
||||||
order.contactInfo.requestTextUpdates = data?.customer?.isSmsOptIn;
|
order.contactInfo.requestTextUpdates = data?.customer?.isSmsOptIn;
|
||||||
|
|
||||||
order.payment.insuranceCoverage.isVerified = data?.payment?.insuranceCoverage?.isVerified;
|
order.payment.insuranceCoverage.isVerified = data?.payment?.insuranceCoverage?.isVerified;
|
||||||
|
|
@ -1775,8 +1780,11 @@ export const useMainStore = defineStore({
|
||||||
this.order.policy.damageState = welcomePageModel?.damageState;
|
this.order.policy.damageState = welcomePageModel?.damageState;
|
||||||
this.order.policy.damageCity = welcomePageModel?.damageCity;
|
this.order.policy.damageCity = welcomePageModel?.damageCity;
|
||||||
this.order.policy.isDamageGlassOnly = welcomePageModel?.isDamageGlassOnly;
|
this.order.policy.isDamageGlassOnly = welcomePageModel?.isDamageGlassOnly;
|
||||||
this.order.customer.phoneNumber = welcomePageModel?.phoneNumber;
|
|
||||||
this.order.customer.emailAddress = welcomePageModel?.email;
|
this.order.customer.emailAddress = welcomePageModel?.email;
|
||||||
|
this.updatePhoneNumbers({
|
||||||
|
home: welcomePageModel?.phoneNumber,
|
||||||
|
service: welcomePageModel?.phoneNumber
|
||||||
|
});
|
||||||
},
|
},
|
||||||
updatePolicyHolderDetails(customerQuestions) {
|
updatePolicyHolderDetails(customerQuestions) {
|
||||||
this.order.customer.address.streetAddress = customerQuestions.addressQuestions.streetAddress;
|
this.order.customer.address.streetAddress = customerQuestions.addressQuestions.streetAddress;
|
||||||
|
|
@ -2123,11 +2131,17 @@ export const useMainStore = defineStore({
|
||||||
this.order.contactInfo.firstName = contactInfo?.firstName ?? '';
|
this.order.contactInfo.firstName = contactInfo?.firstName ?? '';
|
||||||
this.order.contactInfo.lastName = contactInfo?.lastName ?? '';
|
this.order.contactInfo.lastName = contactInfo?.lastName ?? '';
|
||||||
this.order.contactInfo.emailAddress = contactInfo?.emailAddress ?? '';
|
this.order.contactInfo.emailAddress = contactInfo?.emailAddress ?? '';
|
||||||
this.order.contactInfo.phoneNumber = contactInfo?.phoneNumber ?? '';
|
|
||||||
this.order.contactInfo.requestTextUpdates = contactInfo?.requestTextUpdates ?? false;
|
this.order.contactInfo.requestTextUpdates = contactInfo?.requestTextUpdates ?? false;
|
||||||
this.order.contactInfo.notesForTechnician = contactInfo?.notesForTechnician ?? '';
|
this.order.contactInfo.notesForTechnician = contactInfo?.notesForTechnician ?? '';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updatePhoneNumbers(phoneNumbers) {
|
||||||
|
const contact = this.order.contactInfo;
|
||||||
|
contact.homePhone = phoneNumbers.home !== undefined ? phoneNumbers.home : contact.homePhone;
|
||||||
|
contact.alternativePhone = phoneNumbers.alternative !== undefined ? phoneNumbers.alternative : contact.alternativePhone;
|
||||||
|
contact.servicePhone = phoneNumbers.service !== undefined ? phoneNumbers.service : contact.servicePhone;
|
||||||
|
},
|
||||||
|
|
||||||
GetExperimentsByUser(userId) {
|
GetExperimentsByUser(userId) {
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.GetExperimentsByUser.method,
|
method: endpoints.GetExperimentsByUser.method,
|
||||||
|
|
@ -2279,8 +2293,11 @@ export const useMainStore = defineStore({
|
||||||
setBailoutContactInfo(contact) {
|
setBailoutContactInfo(contact) {
|
||||||
this.order.customer.firstName = contact.firstName;
|
this.order.customer.firstName = contact.firstName;
|
||||||
this.order.customer.lastName = contact.lastName;
|
this.order.customer.lastName = contact.lastName;
|
||||||
this.order.customer.phoneNumber = contact.phoneNumber;
|
|
||||||
this.order.customer.emailAddress = contact.email;
|
this.order.customer.emailAddress = contact.email;
|
||||||
|
this.updatePhoneNumbers({
|
||||||
|
home: contact.phoneNumber,
|
||||||
|
service: contact.phoneNumber
|
||||||
|
});
|
||||||
this.pageData(issPageValues.BAILOUT_PAGE).submit = true;
|
this.pageData(issPageValues.BAILOUT_PAGE).submit = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -2311,7 +2328,6 @@ export const useMainStore = defineStore({
|
||||||
this.order.policy.damageCity = null;
|
this.order.policy.damageCity = null;
|
||||||
this.order.policy.damageState = null;
|
this.order.policy.damageState = null;
|
||||||
this.order.policy.isITAC = false;
|
this.order.policy.isITAC = false;
|
||||||
this.order.customer.phoneNumber = null;
|
|
||||||
this.order.customer.emailAddress = null;
|
this.order.customer.emailAddress = null;
|
||||||
this.order.customer.firstName = null;
|
this.order.customer.firstName = null;
|
||||||
this.order.customer.lastName = null;
|
this.order.customer.lastName = null;
|
||||||
|
|
|
||||||
|
|
@ -478,7 +478,6 @@ describe('Store', () => {
|
||||||
const firstName = getRandomString(4, 10);
|
const firstName = getRandomString(4, 10);
|
||||||
const lastName = getRandomString(5, 15);
|
const lastName = getRandomString(5, 15);
|
||||||
const emailAddress = false;
|
const emailAddress = false;
|
||||||
const phoneNumber = getRandomInt(1000000000, 9999999999);
|
|
||||||
const requestTextUpdates = getRandomBoolean();
|
const requestTextUpdates = getRandomBoolean();
|
||||||
const notesForTechnician = getRandomString(50, 150);
|
const notesForTechnician = getRandomString(50, 150);
|
||||||
|
|
||||||
|
|
@ -486,7 +485,6 @@ describe('Store', () => {
|
||||||
store.updateContactInfo({ firstName,
|
store.updateContactInfo({ firstName,
|
||||||
lastName,
|
lastName,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
phoneNumber,
|
|
||||||
requestTextUpdates,
|
requestTextUpdates,
|
||||||
notesForTechnician });
|
notesForTechnician });
|
||||||
|
|
||||||
|
|
@ -494,10 +492,27 @@ describe('Store', () => {
|
||||||
expect(store.contactInfo.firstName).toEqual(firstName);
|
expect(store.contactInfo.firstName).toEqual(firstName);
|
||||||
expect(store.contactInfo.lastName).toEqual(lastName);
|
expect(store.contactInfo.lastName).toEqual(lastName);
|
||||||
expect(store.contactInfo.emailAddress).toEqual(emailAddress);
|
expect(store.contactInfo.emailAddress).toEqual(emailAddress);
|
||||||
expect(store.contactInfo.phoneNumber).toEqual(phoneNumber);
|
|
||||||
expect(store.contactInfo.requestTextUpdates).toEqual(requestTextUpdates);
|
expect(store.contactInfo.requestTextUpdates).toEqual(requestTextUpdates);
|
||||||
expect(store.contactInfo.notesForTechnician).toEqual(notesForTechnician);
|
expect(store.contactInfo.notesForTechnician).toEqual(notesForTechnician);
|
||||||
});
|
});
|
||||||
|
it('updatePhoneNumbers updates phone info in store', () => {
|
||||||
|
// Arrange
|
||||||
|
const homePhone = getRandomInt(1000000000, 9999999999);
|
||||||
|
const servicePhone = getRandomInt(1000000000, 9999999999);
|
||||||
|
const altPhone = getRandomInt(1000000000, 9999999999);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
store.updatePhoneNumbers({
|
||||||
|
home: homePhone,
|
||||||
|
service: servicePhone,
|
||||||
|
alternative: altPhone
|
||||||
|
});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(store.contactInfo.homePhone).toEqual(homePhone);
|
||||||
|
expect(store.contactInfo.servicePhone).toEqual(servicePhone);
|
||||||
|
expect(store.contactInfo.alternativePhone).toEqual(altPhone);
|
||||||
|
});
|
||||||
it('All null values => contact info set in store to all nulls', () => {
|
it('All null values => contact info set in store to all nulls', () => {
|
||||||
// Act
|
// Act
|
||||||
store.updateContactInfo({});
|
store.updateContactInfo({});
|
||||||
|
|
@ -506,7 +521,6 @@ describe('Store', () => {
|
||||||
expect(store.contactInfo.firstName).toEqual('');
|
expect(store.contactInfo.firstName).toEqual('');
|
||||||
expect(store.contactInfo.lastName).toEqual('');
|
expect(store.contactInfo.lastName).toEqual('');
|
||||||
expect(store.contactInfo.emailAddress).toEqual('');
|
expect(store.contactInfo.emailAddress).toEqual('');
|
||||||
expect(store.contactInfo.phoneNumber).toEqual('');
|
|
||||||
expect(store.contactInfo.requestTextUpdates).toEqual(false);
|
expect(store.contactInfo.requestTextUpdates).toEqual(false);
|
||||||
expect(store.contactInfo.notesForTechnician).toEqual('');
|
expect(store.contactInfo.notesForTechnician).toEqual('');
|
||||||
});
|
});
|
||||||
|
|
@ -666,8 +680,9 @@ describe('Store', () => {
|
||||||
store.order.customer.firstName = customerFirstName;
|
store.order.customer.firstName = customerFirstName;
|
||||||
store.order.customer.lastName = customerLastName;
|
store.order.customer.lastName = customerLastName;
|
||||||
store.order.customer.emailAddress = customerEmail;
|
store.order.customer.emailAddress = customerEmail;
|
||||||
store.order.customer.phoneNumber = customerPhoneNumber;
|
|
||||||
store.order.customer.address.state = customerState;
|
store.order.customer.address.state = customerState;
|
||||||
|
store.order.contactInfo.homePhone = customerPhoneNumber;
|
||||||
|
store.order.contactInfo.servicePhone = customerPhoneNumber;
|
||||||
store.order.policy.policyNumber = policyNumber;
|
store.order.policy.policyNumber = policyNumber;
|
||||||
store.order.policy.policyZipCode = policyZipCode;
|
store.order.policy.policyZipCode = policyZipCode;
|
||||||
store.order.policy.policyLookupSuccessful = policyLookupSuccessful;
|
store.order.policy.policyLookupSuccessful = policyLookupSuccessful;
|
||||||
|
|
@ -708,12 +723,16 @@ describe('Store', () => {
|
||||||
const contactFirstName = getRandomString(6, 6);
|
const contactFirstName = getRandomString(6, 6);
|
||||||
const contactLastName = getRandomString(6, 6);
|
const contactLastName = getRandomString(6, 6);
|
||||||
const contactEmail = getRandomString(6, 6);
|
const contactEmail = getRandomString(6, 6);
|
||||||
const contactPhoneNumber = getRandomString(6, 6);
|
const contactHomePhone = getRandomString(6, 6);
|
||||||
|
const contactServicePhone = getRandomString(6, 6);
|
||||||
|
const contactAlternativePhone = getRandomString(6, 6);
|
||||||
const requestTextUpdates = getRandomBoolean();
|
const requestTextUpdates = getRandomBoolean();
|
||||||
store.order.contactInfo.firstName = contactFirstName;
|
store.order.contactInfo.firstName = contactFirstName;
|
||||||
store.order.contactInfo.lastName = contactLastName;
|
store.order.contactInfo.lastName = contactLastName;
|
||||||
store.order.contactInfo.emailAddress = contactEmail;
|
store.order.contactInfo.emailAddress = contactEmail;
|
||||||
store.order.contactInfo.phoneNumber = contactPhoneNumber;
|
store.order.contactInfo.homePhone = contactHomePhone;
|
||||||
|
store.order.contactInfo.servicePhone = contactServicePhone;
|
||||||
|
store.order.contactInfo.alternativePhone = contactAlternativePhone;
|
||||||
store.order.contactInfo.requestTextUpdates = requestTextUpdates;
|
store.order.contactInfo.requestTextUpdates = requestTextUpdates;
|
||||||
store.order.customer.address.streetAddress = streetAddress;
|
store.order.customer.address.streetAddress = streetAddress;
|
||||||
store.order.customer.address.streetAddress2 = streetAddress2;
|
store.order.customer.address.streetAddress2 = streetAddress2;
|
||||||
|
|
@ -740,8 +759,10 @@ describe('Store', () => {
|
||||||
emailAddress: contactEmail,
|
emailAddress: contactEmail,
|
||||||
firstName: contactFirstName,
|
firstName: contactFirstName,
|
||||||
lastName: contactLastName,
|
lastName: contactLastName,
|
||||||
phoneNumber: contactPhoneNumber,
|
homePhone: contactHomePhone,
|
||||||
optInSms: requestTextUpdates
|
servicePhone: contactServicePhone,
|
||||||
|
alternativePhone: contactAlternativePhone,
|
||||||
|
isSmsOptIn: requestTextUpdates
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
|
|
@ -1122,7 +1143,7 @@ describe('Store', () => {
|
||||||
expect(store.order.customer.firstName).toBe(customer.firstName);
|
expect(store.order.customer.firstName).toBe(customer.firstName);
|
||||||
expect(store.order.customer.lastName).toBe(customer.lastName);
|
expect(store.order.customer.lastName).toBe(customer.lastName);
|
||||||
expect(store.order.customer.emailAddress).toBe(customer.emailAddress);
|
expect(store.order.customer.emailAddress).toBe(customer.emailAddress);
|
||||||
expect(store.order.customer.phoneNumber).toBe(customer.phoneNumber);
|
expect(store.order.contactInfo.homePhone).toBe(customer.phoneNumber);
|
||||||
});
|
});
|
||||||
it('sets expected remaining order data', async () => {
|
it('sets expected remaining order data', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue