add unit test

This commit is contained in:
Katie Kroell 2026-03-18 11:30:26 -04:00
parent cb7e4fa714
commit d6298e9baf

View file

@ -2489,4 +2489,64 @@ describe('Store', () => {
expect(store.order.contactInfo.alternativePhone).toBeUndefined();
});
});
describe('updateSupportingItems method', () => {
it('updateSupportingItems removes Recyle Fee and Labor2 Fee from supporting items in store', () => {
// Arrange
const partsData = [
{
partNumber: 'RECYCLE FEE',
partType: 'REPLACE FEE'
},
{
partNumber: 'LABOR2',
partType: 'NON_GLASS'
}
];
// Act
store.updateSupportingItems(partsData);
// Assert
expect.not.objectContaining({
partNumber: 'RECYCLE FEE',
partType: 'REPLACE FEE'
});
expect.not.objectContaining({
partNumber: 'LABOR2',
partType: 'NON_GLASS'
});
});
it('updatePhoneNumbers updates phone info in store', () => {
// Arrange
const homePhone = getRandomInt(1000000000, 9999999999);
const servicePhone = getRandomInt(1000000000, 9999999999);
const altPhone = getRandomInt(1000000000, 9999999999);
const extension = getRandomInt(10000, 99999);
// Act
store.updatePhoneNumbers({
home: homePhone,
service: servicePhone,
alternative: altPhone,
extension
});
// Assert
expect(store.contactInfo.homePhone).toEqual(homePhone);
expect(store.contactInfo.servicePhone).toEqual(servicePhone);
expect(store.contactInfo.alternativePhone).toEqual(altPhone);
expect(store.contactInfo.extension).toEqual(extension);
});
it('All null values => contact info set in store to all null/default', () => {
// Act
store.updateContactInfo({});
// Assert
expect(store.contactInfo.firstName).toEqual(null);
expect(store.contactInfo.lastName).toEqual(null);
expect(store.contactInfo.emailAddress).toEqual(null);
expect(store.contactInfo.requestTextUpdates).toEqual(false);
expect(store.contactInfo.notesForTechnician).toEqual('');
});
});
});