23 lines
874 B
JavaScript
23 lines
874 B
JavaScript
import { shallowMount } from "@vue/test-utils";
|
|
import radioQuestion from "@/common-components/radio-question/radio-question";
|
|
|
|
describe("radioQuestion.vue", () => {
|
|
it("Should render the 'questionText' prop value as a span value for the radio question and the 'answer' values should render as text values for radio components.", async () => {
|
|
// Act
|
|
const wrapper = shallowMount(radioQuestion);
|
|
await wrapper.setProps({
|
|
questionText: "Question Text",
|
|
answers: ["2023", "2022", "2021"],
|
|
modelValue: "2020",
|
|
});
|
|
wrapper.vm.chooseAnswer("2021");
|
|
|
|
// Assert
|
|
expect(wrapper.find(".needed_car_info-text").text()).toEqual(
|
|
"Question Text"
|
|
);
|
|
const radioButtons = wrapper.findAllComponents('[data-test="radio"]');
|
|
expect(radioButtons.length).toBe(3);
|
|
expect(wrapper.props().modelValue).toBe("2020");
|
|
});
|
|
});
|