unit testing
This commit is contained in:
parent
75f7c4abbc
commit
4006d26c30
1 changed files with 6 additions and 4 deletions
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue