DigitalConsumer.FixMyGlass/src/common-components/radio-question/radio-question.spec.js

23 lines
836 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.", () => {
// Act
const wrapper = shallowMount(radioQuestion, {
propsData: {
questionText: "Question Text",
answers: ["2023", "2022", "2021"],
modelValue: '2020'
},
});
// 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");
});
});