DigitalConsumer.FixMyGlass/src/commonComponents/radioQuestion/radioQuestion.spec.js
2021-11-10 09:50:51 -05:00

23 lines
No EOL
1,006 B
JavaScript

import { shallowMount } from '@vue/test-utils';
import radioQuestion from './radioQuestion';
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: ['Value_1', 'Value_2', 'Value_3'],
chooseAnswer: function(){ console.log('test') }
}
});
const radioButtons = wrapper.findAllComponents('[data-test="radio"]')
// Assert
expect(wrapper.find('.needed_car_info-text').text()).toEqual('Question Text');
expect(radioButtons[0].attributes('text')).toEqual('Value_1');
expect(radioButtons[2].attributes('text')).toEqual('Value_3');
expect(typeof wrapper.props().chooseAnswer).toBe('function');
})
})