Update capability-questions.spec.js
This commit is contained in:
parent
af50992a0c
commit
9112046093
1 changed files with 42 additions and 2 deletions
|
|
@ -144,10 +144,12 @@ describe("capabilityQuestions.vue", () => {
|
|||
});
|
||||
|
||||
describe("watch on selectedAnswers should be set up...", () => {
|
||||
test("Should trigger handleCompletedQuestionChainAnswers if watched data changes", async () => {
|
||||
test("Should trigger handleAnswerUpdates if watched data changes", async () => {
|
||||
// Arrange
|
||||
useMainStore().pageData = baseStoreGettersPageData;
|
||||
useMainStore().damage = baseStoreGettersDamage;
|
||||
const { wrapper } = setupMocks({});
|
||||
const spy = jest.spyOn(wrapper.vm, "handleCompletedQuestionChainAnswers");
|
||||
const spy = jest.spyOn(wrapper.vm, "handleAnswerUpdates");
|
||||
|
||||
// Act
|
||||
wrapper.setData({
|
||||
|
|
@ -257,6 +259,44 @@ describe("capabilityQuestions.vue", () => {
|
|||
expect(wrapper.vm.saveCapabilityQuestionAnswers).toHaveBeenCalled;
|
||||
wrapper.unmount();
|
||||
});
|
||||
test("Should call GET_PARTS_OR_QUESTIONS API", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({});
|
||||
|
||||
wrapper.vm.questionsData = [
|
||||
{
|
||||
glassLocation: "Windshield",
|
||||
glassName: "Single",
|
||||
answerData: {
|
||||
answerResult: "FW04848",
|
||||
answeredQuestions: [],
|
||||
},
|
||||
questions: [],
|
||||
parts: [
|
||||
{
|
||||
childPartQuestions: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
useMainStore().getPartsOrQuestions = jest.fn(() => {
|
||||
return {
|
||||
data: {
|
||||
partsOrQuestions: [],
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
// Act
|
||||
wrapper.vm.forwardButtonAction();
|
||||
|
||||
await nextTick();
|
||||
|
||||
//Assert
|
||||
expect(wrapper.vm.getPartsOrQuestions).toHaveBeenCalled;
|
||||
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
test("Should trigger navigateForward", async () => {
|
||||
// Arrange
|
||||
|
|
|
|||
Loading…
Reference in a new issue