Adding store tests
This commit is contained in:
parent
09adcc1114
commit
0ef1d5046d
4 changed files with 54 additions and 9 deletions
|
|
@ -83,7 +83,7 @@
|
||||||
class="disclaimer-link"
|
class="disclaimer-link"
|
||||||
linkType="text"
|
linkType="text"
|
||||||
text="Terms of Use"
|
text="Terms of Use"
|
||||||
href="//www.safelite.com/terms-of-use" />{{ "." }}
|
href="//www.safelite.com/terms-of-use" />.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<siteFooter
|
<siteFooter
|
||||||
|
|
|
||||||
|
|
@ -1138,12 +1138,12 @@ export const useMainStore = defineStore({
|
||||||
},
|
},
|
||||||
|
|
||||||
updateContactInfo(contactInfo) {
|
updateContactInfo(contactInfo) {
|
||||||
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.phoneNumber = contactInfo?.phoneNumber ?? '';
|
||||||
this.order.contactInfo.requestTextUpdates = contactInfo.requestTextUpdates;
|
this.order.contactInfo.requestTextUpdates = contactInfo?.requestTextUpdates ?? false;
|
||||||
this.order.contactInfo.notesForTechnician = contactInfo.notesForTechnician;
|
this.order.contactInfo.notesForTechnician = contactInfo?.notesForTechnician ?? '';
|
||||||
},
|
},
|
||||||
|
|
||||||
GetExperimentsByUser(userId) {
|
GetExperimentsByUser(userId) {
|
||||||
|
|
|
||||||
|
|
@ -424,6 +424,43 @@ describe("Store", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO add tests
|
describe('updateContactInfo method', () => {
|
||||||
describe('updateContactInfo method', () => {});
|
it('UpdateContactInfo updates contact info in store', () => {
|
||||||
|
// Arrange
|
||||||
|
const firstName = getRandomString(4, 10);
|
||||||
|
const lastName = getRandomString(5, 15);
|
||||||
|
const emailAddress = false;
|
||||||
|
const phoneNumber = getRandomInt(1000000000, 9999999999);
|
||||||
|
const requestTextUpdates = getRandomBoolean();
|
||||||
|
const notesForTechnician = getRandomString(50, 150);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
store.updateContactInfo({ firstName,
|
||||||
|
lastName,
|
||||||
|
emailAddress,
|
||||||
|
phoneNumber,
|
||||||
|
requestTextUpdates,
|
||||||
|
notesForTechnician });
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(store.contactInfo.firstName).toEqual(firstName);
|
||||||
|
expect(store.contactInfo.lastName).toEqual(lastName);
|
||||||
|
expect(store.contactInfo.emailAddress).toEqual(emailAddress);
|
||||||
|
expect(store.contactInfo.phoneNumber).toEqual(phoneNumber);
|
||||||
|
expect(store.contactInfo.requestTextUpdates).toEqual(requestTextUpdates);
|
||||||
|
expect(store.contactInfo.notesForTechnician).toEqual(notesForTechnician);
|
||||||
|
});
|
||||||
|
it('All null values => contact info set in store to all nulls', () => {
|
||||||
|
// Act
|
||||||
|
store.updateContactInfo({});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(store.contactInfo.firstName).toEqual('');
|
||||||
|
expect(store.contactInfo.lastName).toEqual('');
|
||||||
|
expect(store.contactInfo.emailAddress).toEqual('');
|
||||||
|
expect(store.contactInfo.phoneNumber).toEqual('');
|
||||||
|
expect(store.contactInfo.requestTextUpdates).toEqual(false);
|
||||||
|
expect(store.contactInfo.notesForTechnician).toEqual('');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -75,4 +75,12 @@ describe("checkbox.vue", () => {
|
||||||
|
|
||||||
expect(paragraph.text()).toEqual("screenreader text");
|
expect(paragraph.text()).toEqual("screenreader text");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Default isChecked is false', async () => {
|
||||||
|
// Act
|
||||||
|
const wrapper = shallowMount(checkbox, {});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.isChecked).toEqual(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue