Skip to content

Commit fc3db43

Browse files
committed
Added tests
1 parent e463eaa commit fc3db43

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

test/TinyPagination.spec.js

+22-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
1-
import {shallow} from 'vue-test-utils'
2-
import {createRenderer} from 'vue-server-renderer'
3-
1+
import {mount} from 'vue-test-utils'
42
import TinyPagination from '../src/components/TinyPagination.vue'
53

4+
// Helper function to create a component
5+
const createComponent = propsData => mount(TinyPagination, {propsData})
6+
67
describe('TinyPagination.vue', () => {
8+
let cmp
9+
710
it('has a created hook', () => {
811
expect(typeof TinyPagination.created).toBe('function')
912
})
13+
14+
it('when the page property is set, the currentPage is equals', () => {
15+
cmp = createComponent({total: 300, page: 2})
16+
expect(cmp.vm.currentPage).toBe(2)
17+
})
18+
19+
it('Page 1 is the page by default', () => {
20+
cmp = createComponent({total: 300})
21+
expect(cmp.vm.page).toBe(1)
22+
})
23+
24+
it('English is the language by default', () => {
25+
cmp = createComponent({total: 300})
26+
expect(cmp.vm.lang).toBe('en')
27+
})
28+
1029
})

0 commit comments

Comments
 (0)