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"], chooseAnswer: function (test) { console.log(test); }, }, }); // 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(typeof wrapper.props().chooseAnswer).toBe("function"); }); });