Skip to content
This repository was archived by the owner on Feb 24, 2023. It is now read-only.

Commit 08c3081

Browse files
initialSettings unit test
1 parent 7f01da6 commit 08c3081

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/unit/settings.spec.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { shallowMount } from '@vue/test-utils'
2+
import Agile from '@/Agile.vue'
3+
4+
5+
describe('Settings:', () => {
6+
describe('initialSettings object:', () => {
7+
test('should contain all possible props without options', async () => {
8+
const { vm } = shallowMount(Agile)
9+
const { initialSettings, $props } = vm
10+
11+
Object.keys($props).forEach(key => {
12+
const condition = key !== 'options'
13+
expect(initialSettings.hasOwnProperty(key)).toEqual(condition)
14+
})
15+
})
16+
17+
test('options object should be merged with other props', async () => {
18+
const { vm } = shallowMount(Agile, {
19+
propsData: {
20+
options: {
21+
infinite: false,
22+
fade: true,
23+
throttle: 0
24+
}
25+
}
26+
})
27+
28+
const { initialSettings, $props } = vm
29+
30+
expect(initialSettings.infinite).toEqual(false)
31+
expect(initialSettings.fade).toEqual(true)
32+
expect(initialSettings.throttle).toEqual(0)
33+
})
34+
})
35+
})

0 commit comments

Comments
 (0)