diff --git a/src/commonComponents/radioQuestion/radioQuestion.spec.js b/src/commonComponents/radioQuestion/radioQuestion.spec.js index 7da128d0b..e6689a63a 100644 --- a/src/commonComponents/radioQuestion/radioQuestion.spec.js +++ b/src/commonComponents/radioQuestion/radioQuestion.spec.js @@ -8,14 +8,13 @@ describe('radioQuestion.vue', () => { propsData: { questionText: 'Question Text', answers: ['Value_1', 'Value_2', 'Value_3'], - chooseAnswer: function(){ console.log('test') } + chooseAnswer: function(test){ console.log(test) } } }); - const radioButtons = wrapper.findAllComponents('[data-test="radio"]') - // Assert expect(wrapper.find('.needed_car_info-text').text()).toEqual('Question Text'); + const radioButtons = wrapper.findAllComponents('[data-test="radio"]'); expect(radioButtons[0].attributes('text')).toEqual('Value_1'); expect(radioButtons[2].attributes('text')).toEqual('Value_3'); expect(typeof wrapper.props().chooseAnswer).toBe('function'); diff --git a/src/layouts/selectYear/selectYear.spec.js b/src/layouts/selectYear/selectYear.spec.js index cd791df22..b380b4e02 100644 --- a/src/layouts/selectYear/selectYear.spec.js +++ b/src/layouts/selectYear/selectYear.spec.js @@ -1,9 +1,27 @@ import { shallowMount } from '@vue/test-utils'; -import SelectYear from './SelectYear'; +import selectYear from './selectYear'; -test('SelectYear', () => { - // render the component - const wrapper = shallowMount(SelectYear, { +describe('selectYear.vue', () => { + it("Should render the 'pageHeader.Text' data value 'text' prop value for the Header component, 'radioQuestion.Question' data value as 'questionText' prop value for the 'radioQuestion' component and 'years' values for 'answers' prop values for the 'radioQuestion' component.", async () => { + // Act + const wrapper = shallowMount(selectYear); + + await wrapper.setData({ + years: ['2023', '2022', '2021'], + pageHeader: { + Text: "Test page header" + }, + radioQuestion: { + Question: "Test question" + } + }); + + // Assert + const header = wrapper.findComponent('.Header'); + expect(header.attributes('text')).toEqual('Test page header'); - }); -}); \ No newline at end of file + const radioQuestion = wrapper.findComponent('.radioQuestion'); + expect(radioQuestion.attributes('answers')).toEqual('2023,2022,2021'); + expect(radioQuestion.attributes('questiontext')).toEqual('Test question'); + }) +}) \ No newline at end of file diff --git a/src/layouts/selectYear/selectYear.vue b/src/layouts/selectYear/selectYear.vue index 6e9665c28..be0303fc4 100644 --- a/src/layouts/selectYear/selectYear.vue +++ b/src/layouts/selectYear/selectYear.vue @@ -3,9 +3,10 @@
{ response.data.Result.forEach((m) => { switch (m.Type) { diff --git a/src/router/index.js b/src/router/index.js index 97a485841..836a6256e 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -4,10 +4,6 @@ import { lazyLoadComponent } from "@/router/dynamic-routing/component-loader.js" import ComponentTest from "@/layouts/componentTest/componentTest.vue"; import NotFound from "@/layouts/notFound/notFound.vue"; import store from "@/store"; -import selectYear from "@/layouts/selectYear/selectYear.vue"; -import selectMake from "@/layouts/selectMake/selectMake.vue"; -import selectModel from "@/layouts/selectModel/selectModel.vue"; -import selectStyle from "@/layouts/selectStyle/selectStyle.vue"; const routes = [ { @@ -65,26 +61,6 @@ const routes = [ } }, }, - { - path: "/select-year", - name: "selectYear", - component: selectYear, - }, - { - path: "/select-make", - name: "selectMake", - component: selectMake, - }, - { - path: "/select-model", - name: "selectModel", - component: selectModel, - }, - { - path: "/select-style", - name: "selectStyle", - component: selectStyle, - }, ]; const router = createRouter({