From 4006d26c30179beef016101467206342b3d11447 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 6 Dec 2021 17:01:28 -0500 Subject: [PATCH] unit testing --- .../radio-question/radio-question.spec.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/common-components/radio-question/radio-question.spec.js b/src/common-components/radio-question/radio-question.spec.js index 671926086..0187888bc 100644 --- a/src/common-components/radio-question/radio-question.spec.js +++ b/src/common-components/radio-question/radio-question.spec.js @@ -7,11 +7,13 @@ describe("radioQuestion.vue", () => { // Arrange const chooseAnswer = jest.fn(); chooseAnswer.mockImplementation((answer) => { - mockData.answer = answer; + mockData.data.answer = answer; }); const mockData = { chooseAnswer: chooseAnswer, - answer: '' + data: { + answer: null + } } const mountOptions = getMountOptions(mockData); @@ -23,8 +25,7 @@ describe("radioQuestion.vue", () => { answers: ["2023", "2022", "2021"], modelValue: "2020" }); - //wrapper.vm.chooseAnswer("2021"); - console.log(mockData.answer); + wrapper.vm.chooseAnswer("2021"); // Assert expect(wrapper.find(".needed_car_info-text").text()).toEqual( @@ -33,5 +34,6 @@ describe("radioQuestion.vue", () => { const radioButtons = wrapper.findAllComponents('[data-test="radio"]'); expect(radioButtons.length).toBe(3); expect(wrapper.props().modelValue).toBe("2020"); + expect(mockData.data.answer).toBe("2021"); }); });