diff --git a/src/commonComponents/radioQuestion/radioQuestion.spec.js b/src/commonComponents/radioQuestion/radioQuestion.spec.js index e6689a63a..45a68e306 100644 --- a/src/commonComponents/radioQuestion/radioQuestion.spec.js +++ b/src/commonComponents/radioQuestion/radioQuestion.spec.js @@ -7,7 +7,7 @@ describe('radioQuestion.vue', () => { const wrapper = shallowMount(radioQuestion, { propsData: { questionText: 'Question Text', - answers: ['Value_1', 'Value_2', 'Value_3'], + answers: [2023, 2022, 2021], chooseAnswer: function(test){ console.log(test) } } }); @@ -15,8 +15,8 @@ describe('radioQuestion.vue', () => { // 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(radioButtons[0].attributes('text')).toEqual('2023'); + expect(radioButtons[2].attributes('text')).toEqual('2021'); expect(typeof wrapper.props().chooseAnswer).toBe('function'); }) }) \ No newline at end of file diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index 74725eed4..a390db3ec 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -18,6 +18,9 @@ const endpoints = { GetStyles: { url: '/vehicle/api/v1/vehicle/Styles', method: 'POST' + }, + GetPageData: { + method: 'GET' } } diff --git a/src/global-methods.js b/src/global-methods.js index 824a87266..f2ad4f043 100644 --- a/src/global-methods.js +++ b/src/global-methods.js @@ -11,7 +11,7 @@ export default { axios({ method: method, - url: `${apiGatewayUrl}${endpoint}`, + url: apiGatewayUrl + endpoint, data: payloadAndAnalyticsData, crossDomain: true, responseType: {}, @@ -29,4 +29,27 @@ export default { ); }); }, + // For mock use only! + callMockHttpClient({ method, endpoint}) { + return new Promise((resolve, reject) => { + + axios({ + method: method, + url: endpoint, + crossDomain: true, + responseType: {}, + }).then((response) => { + + if (response.status == httpStatusCodes.OK) { + resolve(response); + } else { + reject(response); + } + }, + (error) => { + return reject(error.response); + } + ); + }); + } }; diff --git a/src/layouts/selectYear/selectYear.spec.js b/src/layouts/selectYear/selectYear.spec.js index b380b4e02..f92c5cfc3 100644 --- a/src/layouts/selectYear/selectYear.spec.js +++ b/src/layouts/selectYear/selectYear.spec.js @@ -1,14 +1,15 @@ -import { shallowMount } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import selectYear from './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); + const wrapper = mount(selectYear); await wrapper.setData({ years: ['2023', '2022', '2021'], - pageHeader: { + pageHeader: { Text: "Test page header" }, radioQuestion: { @@ -19,7 +20,7 @@ describe('selectYear.vue', () => { // Assert const header = wrapper.findComponent('.Header'); expect(header.attributes('text')).toEqual('Test page header'); - + const radioQuestion = wrapper.findComponent('.radioQuestion'); expect(radioQuestion.attributes('answers')).toEqual('2023,2022,2021'); expect(radioQuestion.attributes('questiontext')).toEqual('Test question'); diff --git a/src/layouts/selectYear/selectYear.vue b/src/layouts/selectYear/selectYear.vue index be0303fc4..0c9ba5ea2 100644 --- a/src/layouts/selectYear/selectYear.vue +++ b/src/layouts/selectYear/selectYear.vue @@ -18,9 +18,6 @@