test: Improve test coverage to 100% for users views (#188)
This commit is contained in:
@@ -35,6 +35,13 @@ describe('User.vue', () => {
|
|||||||
|
|
||||||
expect(typeof User.methods.goBack ).toEqual('function')
|
expect(typeof User.methods.goBack ).toEqual('function')
|
||||||
expect(wrapper.vm.goBack()).toBeUndefined()
|
expect(wrapper.vm.goBack()).toBeUndefined()
|
||||||
|
expect(typeof User.methods.getUserData ).toEqual('function')
|
||||||
|
expect(wrapper.vm.getUserData(1)).toStrictEqual([
|
||||||
|
{ key: 'username', value: 'Samppa Nori' },
|
||||||
|
{ key: 'registered', value: '2012/01/01' },
|
||||||
|
{ key: 'role', value: 'Member' },
|
||||||
|
{ key: 'status', value: 'Active' } ])
|
||||||
|
expect(wrapper.vm.getUserData(30)).toStrictEqual([{"key": "id", "value": "Not found"}])
|
||||||
})
|
})
|
||||||
test('renders correctly', () => {
|
test('renders correctly', () => {
|
||||||
const wrapper = shallowMount(User, {
|
const wrapper = shallowMount(User, {
|
||||||
|
|||||||
@@ -47,5 +47,8 @@ describe('Users.vue', () => {
|
|||||||
expect(Users.methods.userLink(42)).toBe('users/42')
|
expect(Users.methods.userLink(42)).toBe('users/42')
|
||||||
expect(typeof Users.methods.rowClicked ).toEqual('function')
|
expect(typeof Users.methods.rowClicked ).toEqual('function')
|
||||||
expect(wrapper.vm.rowClicked({id:42})).toBeUndefined()
|
expect(wrapper.vm.rowClicked({id:42})).toBeUndefined()
|
||||||
|
expect(typeof Users.methods.getBadge ).toEqual('function')
|
||||||
|
expect(wrapper.vm.getBadge('Active')).toBe('success')
|
||||||
|
expect(wrapper.vm.getBadge('Inactive')).toBe('secondary')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user