Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bd84c60

Browse filesBrowse files
committed
test: modifications of unit tests
1 parent 6039596 commit bd84c60
Copy full SHA for bd84c60

16 files changed

+168
-204
lines changed

‎src/components/Charts/tests/CSimpleBarChart.spec.js

Copy file name to clipboardExpand all lines: src/components/Charts/tests/CSimpleBarChart.spec.js
-12Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
import Component from "../CSimpleBarChart";
2-
// import { shallowMount } from '@vue/test-utils'
3-
42
const ComponentName = 'CSimpleBarChart'
5-
// import Vue from 'vue'
6-
// const vm = new Vue(Component1).$mount(document.createElement('div'))
7-
//
8-
// /* eslint-disable no-console */
9-
// console.log(vm.$options);
10-
// /* eslint-enable no-console */
11-
12-
// console.log(typeof Component.props.data.default())
13-
// console.log(typeof Component.props.finalOptions.default())
14-
153

164
describe(ComponentName, () => {
175
it('has a name', () => {

‎src/components/Charts/tests/CSimpleLineChart.spec.js

Copy file name to clipboardExpand all lines: src/components/Charts/tests/CSimpleLineChart.spec.js
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Component from "../CSimpleLineChart";
2-
32
const ComponentName = 'CSimpleLineChart'
43

54
describe(ComponentName, () => {
@@ -10,4 +9,8 @@ describe(ComponentName, () => {
109
expect(typeof Component.props.finalOptions.default).toBe('function')
1110
expect(typeof Component.props.data.default).toBe('function')
1211
})
13-
});
12+
it('functions are returning valid default data', () => {
13+
expect(typeof Component.props.finalOptions.default()).toBe('object')
14+
expect(typeof Component.props.data.default()).not.toBe('undefined')
15+
})
16+
})
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import Component from "../CSimplePointedChart";
2-
// import { shallowMount } from '@vue/test-utils'
3-
42
const ComponentName = 'CSimplePointedChart'
3+
54
describe(ComponentName, () => {
65
it('has a name', () => {
76
expect(Component.name).toMatch(ComponentName)
87
})
98
it('has default props functions', () => {
10-
// expect(typeof Component.computed.finalOptions).toBe('function')
9+
expect(typeof Component.computed.finalOptions).toBe('function')
1110
expect(typeof Component.props.data.default).toBe('function')
1211
})
13-
});
12+
it('functions are returning valid default data', () => {
13+
expect(typeof Component.computed.finalOptions()).toBe('object')
14+
expect(typeof Component.props.data.default()).not.toBe('undefined')
15+
})
16+
})

‎src/components/Progress/CProgressBar.js

Copy file name to clipboardExpand all lines: src/components/Progress/CProgressBar.js
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// import { getColor } from '@coreui/coreui/dist/js/coreui-utilities'
2-
// const getColor = utilities.getColor
3-
import getColor from '@coreui/coreui/js/src/utilities/get-color'
1+
import { getColor } from '@coreui/coreui/dist/js/coreui-utilities'
42

53
export default {
64
name: 'CProgressBar',

‎src/components/Progress/tests/CProgress.spec.js

Copy file name to clipboardExpand all lines: src/components/Progress/tests/CProgress.spec.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const wrapper = mount(Component,{
1212
// console.log(wrapper.vm.computedVariant)
1313
// console.log(wrapper.vm.progressBarStyles)
1414

15-
describe(`${ComponentName} .vue`, () => {
15+
describe(ComponentName, () => {
1616
it('has a name', () => {
1717
expect(Component.name).toMatch(ComponentName)
1818
})

‎src/components/Progress/tests/CProgressBar.spec.js

Copy file name to clipboardExpand all lines: src/components/Progress/tests/CProgressBar.spec.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { mount } from '@vue/test-utils'
2-
import Component from "../CProgressBar";
2+
import Component from "../CProgressBar.js";
33

44
const ComponentName = 'CProgressBar'
55
const wrapper = mount(Component,{
@@ -12,7 +12,7 @@ const wrapper = mount(Component,{
1212
// console.log(wrapper.vm.computedVariant)
1313
// console.log(wrapper.vm.progressBarStyles)
1414

15-
describe(`${ComponentName} .vue`, () => {
15+
describe(ComponentName, () => {
1616
it('has a name', () => {
1717
expect(Component.name).toMatch(ComponentName)
1818
})

‎src/components/Progress/tests/__snapshots__/CProgress.spec.js.snap

Copy file name to clipboardExpand all lines: src/components/Progress/tests/__snapshots__/CProgress.spec.js.snap
+34Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,37 @@ exports[`CProgress .vue sets background color correctly 1`] = `
3333
</div>
3434
</div>
3535
`;
36+
37+
exports[`CProgress renders correctly 1`] = `
38+
<div
39+
class="progress"
40+
>
41+
<div
42+
aria-valuemax="100"
43+
aria-valuemin="0"
44+
aria-valuenow="50"
45+
class="progress-bar"
46+
role="progressbar"
47+
style="width: 50%; background-color: black;"
48+
>
49+
<!---->
50+
</div>
51+
</div>
52+
`;
53+
54+
exports[`CProgress sets background color correctly 1`] = `
55+
<div
56+
class="progress"
57+
>
58+
<div
59+
aria-valuemax="100"
60+
aria-valuemin="0"
61+
aria-valuenow="50"
62+
class="progress-bar"
63+
role="progressbar"
64+
style="width: 50%; background-color: black;"
65+
>
66+
<!---->
67+
</div>
68+
</div>
69+
`;

‎src/components/Progress/tests/__snapshots__/CProgressBar.spec.js.snap

Copy file name to clipboardExpand all lines: src/components/Progress/tests/__snapshots__/CProgressBar.spec.js.snap
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,16 @@ exports[`CProgressBar .vue renders correctly 1`] = `
1212
<!---->
1313
</div>
1414
`;
15+
16+
exports[`CProgressBar renders correctly 1`] = `
17+
<div
18+
aria-valuemax="100"
19+
aria-valuemin="0"
20+
aria-valuenow="50"
21+
class="progress-bar"
22+
role="progressbar"
23+
style="width: 50%;"
24+
>
25+
<!---->
26+
</div>
27+
`;

‎src/components/Sidebar/CSidebarNav.vue

Copy file name to clipboardExpand all lines: src/components/Sidebar/CSidebarNav.vue
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ export default {
120120
interceptRailY: styles => ({ ...styles, height: 0 })
121121
}
122122
}
123-
},
124-
methods: {
125-
scrollHandle (evt) {
126-
// console.log(evt)
127-
}
128123
}
124+
// methods: {
125+
// scrollHandle (evt) {
126+
// // console.log(evt)
127+
// }
128+
// }
129129
}
130130
</script>
131131

‎src/components/Sidebar/SidebarNav.vue

Copy file name to clipboardExpand all lines: src/components/Sidebar/SidebarNav.vue
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ export default {
8888
}
8989
}
9090
},
91-
methods: {
92-
scrollHandle (evt) {
93-
// console.log(evt)
94-
}
95-
}
91+
// methods: {
92+
// scrollHandle (evt) {
93+
// // console.log(evt)
94+
// }
95+
// }
9696
}
9797
</script>
9898

‎src/components/Sidebar/SidebarNavLabel.vue

Copy file name to clipboardExpand all lines: src/components/Sidebar/SidebarNavLabel.vue
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66

77
<script>
88
import SidebarNavItem from './SidebarNavItem'
9-
import SidebarNavLink from './SidebarNavLink'
109
export default {
1110
name: 'SidebarNavLabel',
1211
components: {
13-
SidebarNavItem,
14-
SidebarNavLink
12+
SidebarNavItem
1513
},
1614
props: {
1715
name: {

‎src/components/Widgets/tests/CWidget01.spec.js

Copy file name to clipboardExpand all lines: src/components/Widgets/tests/CWidget01.spec.js
+20-65Lines changed: 20 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,3 @@
1-
// import { mount } from '@vue/test-utils'
2-
// import Component from '../CWidget01'
3-
// const ComponentName = 'CWidget01'
4-
// const defaultWrapper = mount(Component)
5-
// const customWrapper = mount(Component,{
6-
// propsData: {
7-
// variant: 'info',
8-
// inverse: true,
9-
// value: 30,
10-
// text:'test',
11-
// header: 'test',
12-
// footer: 'test'
13-
// }
14-
// })
15-
//
16-
// describe(ComponentName, () => {
17-
// it('has a name', () => {
18-
// expect(Component.name).toMatch(ComponentName)
19-
// })
20-
// it('is Vue instance', () => {
21-
// expect(defaultWrapper.isVueInstance()).toBe(true)
22-
// })
23-
// it('correctly sets default props and data when created', () => {
24-
// expect(defaultWrapper.vm.computedCardClasses).toBe('card')
25-
// expect(defaultWrapper.vm.computedBarClasses).toBe('')
26-
// expect(defaultWrapper.vm.computedVariant).toBe('success')
27-
// expect(defaultWrapper.props().header).toBe('header:string')
28-
// expect(defaultWrapper.props().text).toBe('text:string')
29-
// expect(defaultWrapper.props().variant).toBe('success')
30-
// expect(defaultWrapper.props().footer).toBe('footer:string')
31-
// expect(defaultWrapper.props().value).toBe(25)
32-
// expect(defaultWrapper.props().inverse).toBe(false)
33-
// })
34-
// it('matches default props snapshot', () => {
35-
// expect(defaultWrapper.element).toMatchSnapshot()
36-
// })
37-
// it('correctly sets custom props and data when created', () => {
38-
// expect(customWrapper.vm.computedCardClasses).toBe('card text-white bg-info')
39-
// expect(customWrapper.vm.computedBarClasses).toBe('progress-white')
40-
// expect(customWrapper.vm.computedVariant).toBe('')
41-
// expect(customWrapper.props().header).toBe('test')
42-
// expect(customWrapper.props().text).toBe('test')
43-
// expect(customWrapper.props().variant).toBe('info')
44-
// expect(customWrapper.props().footer).toBe('test')
45-
// expect(customWrapper.props().value).toBe(30)
46-
// expect(customWrapper.props().inverse).toBe(true)
47-
// })
48-
// it('matches custom props snapshot', () => {
49-
// expect(customWrapper.element).toMatchSnapshot()
50-
// })
51-
// })
52-
531
import { shallowMount } from '@vue/test-utils'
542
import Component from '../CWidget01'
553

@@ -75,22 +23,29 @@ describe(ComponentName, () => {
7523
it('is functional component', () => {
7624
expect(defaultWrapper.isFunctionalComponent).toBe(true)
7725
})
78-
// it('correctly render component with default props', () => {
79-
// expect(defaultWrapper.findAll('div').at(2).text()).toMatch('header:string')
80-
// expect(defaultWrapper.findAll('div').at(3).text()).toMatch('text:string')
81-
// expect(defaultWrapper.find('i').attributes().class).toMatch('fa fa-cogs bg-primary')
82-
// expect(defaultWrapper.find('clink-stub').exists()).toBe(false)
83-
// })
26+
it('correctly render component with default props', () => {
27+
expect(defaultWrapper.findAll('div').at(0).attributes().class).toMatch('card')
28+
expect(defaultWrapper.findAll('div').at(2).text()).toMatch('header:string')
29+
expect(defaultWrapper.findAll('div').at(3).text()).toMatch('text:string')
30+
expect(defaultWrapper.find('small').text()).toMatch('footer:string')
31+
expect(defaultWrapper.find('cprogress-stub').exists()).toBe(true)
32+
expect(defaultWrapper.find('cprogress-stub').attributes().variant).toBe('success')
33+
expect(defaultWrapper.find('cprogress-stub').attributes().class).toBe('progress-xs my-3 mb-0')
34+
expect(defaultWrapper.find('cprogress-stub').attributes().value).toBe('25')
35+
})
8436
it('matches default props snapshot', () => {
8537
expect(defaultWrapper.element).toMatchSnapshot()
8638
})
87-
// it('correctly render component with custom props', () => {
88-
// expect(customWrapper.findAll('div').at(2).text()).toMatch('header')
89-
// expect(customWrapper.findAll('div').at(3).text()).toMatch('text')
90-
// expect(customWrapper.find('i').attributes().class).toMatch('someClasses')
91-
// expect(customWrapper.find('clink-stub').exists()).toBe(true)
92-
// expect(customWrapper.find('clink-stub').attributes().href).toMatch('link.com')
93-
// })
39+
it('correctly render component with custom props', () => {
40+
expect(customWrapper.findAll('div').at(0).attributes().class).toMatch('card text-white bg-info')
41+
expect(customWrapper.findAll('div').at(2).text()).toMatch('test')
42+
expect(customWrapper.findAll('div').at(3).text()).toMatch('test')
43+
expect(customWrapper.find('small').text()).toMatch('test')
44+
expect(customWrapper.find('cprogress-stub').exists()).toBe(true)
45+
expect(customWrapper.find('cprogress-stub').attributes().variant).toBe('')
46+
expect(customWrapper.find('cprogress-stub').attributes().class).toBe('progress-xs my-3 mb-0 progress-white')
47+
expect(customWrapper.find('cprogress-stub').attributes().value).toBe('30')
48+
})
9449
it('matches custom props snapshot', () => {
9550
expect(customWrapper.element).toMatchSnapshot()
9651
})

‎src/components/Widgets/tests/CWidget05.spec.js

Copy file name to clipboardExpand all lines: src/components/Widgets/tests/CWidget05.spec.js
+20-67Lines changed: 20 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,7 @@
1-
// import Vue from 'vue'
2-
// import { mount } from '@vue/test-utils'
3-
// import Component from '../CWidget05'
4-
//
5-
// const ComponentName = 'CWidget05'
6-
// const defaultWrapper = mount(Component)
7-
// const customWrapper = mount(Component,{
8-
// propsData: {
9-
// text: 'test',
10-
// header: 'test',
11-
// iconClasses: 'icon-custom',
12-
// variant: 'info',
13-
// value: 35,
14-
// inverse: true
15-
// }
16-
// })
17-
//
18-
// describe(ComponentName + '.vue', () => {
19-
// it('has a name', () => {
20-
// expect(Component.name).toMatch(ComponentName)
21-
// })
22-
// it('is Vue instance', () => {
23-
// expect(defaultWrapper.isVueInstance()).toBe(true)
24-
// })
25-
// it('correctly sets default props and data when created', () => {
26-
// expect(defaultWrapper.vm.computedCardClasses).toBe('card')
27-
// expect(defaultWrapper.vm.computedBarClasses).toBe('')
28-
// expect(defaultWrapper.vm.computedVariant).toBe('success')
29-
// expect(defaultWrapper.props().header).toBe('header:string')
30-
// expect(defaultWrapper.props().text).toBe('text:string')
31-
// expect(defaultWrapper.props().variant).toBe('success')
32-
// expect(defaultWrapper.props().value).toBe(25)
33-
// expect(defaultWrapper.props().inverse).toBe(false)
34-
// })
35-
// it('matches default props snapshot', () => {
36-
// expect(defaultWrapper.element).toMatchSnapshot()
37-
// })
38-
// it('correctly sets custom props and data when created', () => {
39-
// expect(customWrapper.vm.computedCardClasses).toBe('card text-white bg-info')
40-
// expect(customWrapper.vm.computedBarClasses).toBe('progress-white')
41-
// expect(customWrapper.vm.computedVariant).toBe('')
42-
// expect(customWrapper.props().header).toBe('test')
43-
// expect(customWrapper.props().text).toBe('test')
44-
// expect(customWrapper.props().variant).toBe('info')
45-
// expect(customWrapper.props().value).toBe(35)
46-
// expect(customWrapper.props().inverse).toBe(true)
47-
// })
48-
// it('matches custom props snapshot', () => {
49-
// expect(customWrapper.element).toMatchSnapshot()
50-
// })
51-
// })
52-
531
import { shallowMount } from '@vue/test-utils'
54-
import Component from '../CWidget01'
2+
import Component from '../CWidget05'
553

56-
const ComponentName = 'CWidget01'
4+
const ComponentName = 'CWidget05'
575
const defaultWrapper = shallowMount(Component)
586
const customWrapper = shallowMount(Component, {
597
context:{
@@ -75,22 +23,27 @@ describe(ComponentName, () => {
7523
it('is functional component', () => {
7624
expect(defaultWrapper.isFunctionalComponent).toBe(true)
7725
})
78-
// it('correctly render component with default props', () => {
79-
// expect(defaultWrapper.findAll('div').at(2).text()).toMatch('header:string')
80-
// expect(defaultWrapper.findAll('div').at(3).text()).toMatch('text:string')
81-
// expect(defaultWrapper.find('i').attributes().class).toMatch('fa fa-cogs bg-primary')
82-
// expect(defaultWrapper.find('clink-stub').exists()).toBe(false)
83-
// })
26+
it('correctly render component with default props', () => {
27+
expect(defaultWrapper.findAll('div').at(0).attributes().class).toMatch('card')
28+
expect(defaultWrapper.findAll('div').at(3).text()).toMatch('header:string')
29+
expect(defaultWrapper.find('small').text()).toMatch('text:string')
30+
expect(defaultWrapper.find('cprogress-stub').exists()).toBe(true)
31+
expect(defaultWrapper.find('cprogress-stub').attributes().variant).toBe('success')
32+
expect(defaultWrapper.find('cprogress-stub').attributes().class).toBe('progress-xs my-3 mb-0')
33+
expect(defaultWrapper.find('cprogress-stub').attributes().value).toBe('25')
34+
})
8435
it('matches default props snapshot', () => {
8536
expect(defaultWrapper.element).toMatchSnapshot()
8637
})
87-
// it('correctly render component with custom props', () => {
88-
// expect(customWrapper.findAll('div').at(2).text()).toMatch('header')
89-
// expect(customWrapper.findAll('div').at(3).text()).toMatch('text')
90-
// expect(customWrapper.find('i').attributes().class).toMatch('someClasses')
91-
// expect(customWrapper.find('clink-stub').exists()).toBe(true)
92-
// expect(customWrapper.find('clink-stub').attributes().href).toMatch('link.com')
93-
// })
38+
it('correctly render component with custom props', () => {
39+
expect(customWrapper.findAll('div').at(0).attributes().class).toMatch('card text-white bg-info')
40+
expect(customWrapper.findAll('div').at(3).text()).toMatch('test')
41+
expect(customWrapper.find('small').text()).toMatch('test')
42+
expect(customWrapper.find('cprogress-stub').exists()).toBe(true)
43+
expect(customWrapper.find('cprogress-stub').attributes().variant).toBe('')
44+
expect(customWrapper.find('cprogress-stub').attributes().class).toBe('progress-xs my-3 mb-0 progress-white')
45+
expect(customWrapper.find('cprogress-stub').attributes().value).toBe('35')
46+
})
9447
it('matches custom props snapshot', () => {
9548
expect(customWrapper.element).toMatchSnapshot()
9649
})

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.