CSR-1012 more unit tests for service-location
This commit is contained in:
parent
b29243f196
commit
5a8b1a9dff
1 changed files with 53 additions and 0 deletions
|
|
@ -101,6 +101,59 @@ describe("service-location.vue", () => {
|
|||
expect(arePagePrerequisitesValid).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("updating service zip", () => {
|
||||
test("resets mobile location when service zip code is updated", () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
const newZip = "61606";
|
||||
|
||||
// Act
|
||||
wrapper.vm.$refs.mobileLocationModalQuestions.resetComponent = jest.fn();
|
||||
wrapper.vm.resetMobileLocation(newZip);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.mobileLocationQuestions.serviceZipCode).toBe(newZip);
|
||||
});
|
||||
|
||||
test("updates service zip code serviceZipCodeQuestion when resetServiceZipCode is called", () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
const newServiceZipCodeQuestion = {
|
||||
zipCode: "61606",
|
||||
state: "IL",
|
||||
isServiceable: true,
|
||||
};
|
||||
|
||||
// Act
|
||||
wrapper.vm.$refs.mobileLocationModalQuestions.resetComponent = jest.fn();
|
||||
wrapper.vm.resetServiceZipCode(newServiceZipCodeQuestion);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.serviceZipCodeQuestion).toStrictEqual(newServiceZipCodeQuestion);
|
||||
});
|
||||
|
||||
test("resets mobile location in watch for serviceZipCodeQuestion", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
const newServiceZipCodeQuestion = {
|
||||
zipCode: "61606",
|
||||
state: "IL",
|
||||
isServiceable: true,
|
||||
};
|
||||
|
||||
// Act
|
||||
wrapper.vm.$refs.mobileLocationModalQuestions.resetComponent = jest.fn();
|
||||
wrapper.vm.serviceZipCodeQuestion = newServiceZipCodeQuestion;
|
||||
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.mobileLocationQuestions.serviceZipCode).toStrictEqual(
|
||||
newServiceZipCodeQuestion.zipCode
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function setupMocks({ mountOptionsMockData = {} }) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue