Unit test for year layout and omitting custom routes for merge
This commit is contained in:
parent
a4244ece3e
commit
8ec76392c1
4 changed files with 29 additions and 34 deletions
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
||||
});
|
||||
});
|
||||
const radioQuestion = wrapper.findComponent('.radioQuestion');
|
||||
expect(radioQuestion.attributes('answers')).toEqual('2023,2022,2021');
|
||||
expect(radioQuestion.attributes('questiontext')).toEqual('Test question');
|
||||
})
|
||||
})
|
||||
|
|
@ -3,9 +3,10 @@
|
|||
<div class="select-car-form rounded text-center">
|
||||
|
||||
<Header
|
||||
:text="pageHeader.Text"
|
||||
:text="pageHeader.Text" class="Header"
|
||||
/>
|
||||
<radioQuestion
|
||||
class="radioQuestion"
|
||||
:questionText="radioQuestion.Question"
|
||||
:answers="this.years"
|
||||
:chooseAnswer="selectYear"
|
||||
|
|
@ -46,6 +47,7 @@ export default {
|
|||
this.years = response.data;
|
||||
});
|
||||
|
||||
// Mocking Sitefinity data
|
||||
axios.get("https://mockey.qa.sagaws.net/service/content/selectYear").then((response) => {
|
||||
response.data.Result.forEach((m) => {
|
||||
switch (m.Type) {
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Reference in a new issue