test: restore and fix unit tests

This commit is contained in:
woothu
2019-08-10 12:07:10 +02:00
parent f9a4949b56
commit 704e04f9f6
89 changed files with 55790 additions and 6 deletions
@@ -0,0 +1,40 @@
import Vue from 'vue'
import { mount, shallowMount } from '@vue/test-utils';
import CoreuiVue from '@coreui/vue'
import ProgressBars from '@/views/base/ProgressBars'
Vue.use(CoreuiVue)
jest.useFakeTimers()
describe('ProgressBars.vue', () => {
it('has a name', () => {
expect(ProgressBars.name).toMatch('progress-bars')
})
it('has a created hook', () => {
expect(typeof ProgressBars.data).toMatch('function')
})
it('sets the correct default data', () => {
expect(typeof ProgressBars.data).toMatch('function')
})
it('is Vue instance', () => {
const wrapper = mount(ProgressBars)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is ProgressBars', () => {
const wrapper = mount(ProgressBars)
expect(wrapper.is(ProgressBars)).toBe(true)
})
test('renders correctly', () => {
const wrapper = shallowMount(ProgressBars)
expect(wrapper.element).toMatchSnapshot()
})
it('should be destroyed', () => {
const wrapper = mount(ProgressBars)
wrapper.destroy()
})
it('should have methods', () => {
expect(typeof ProgressBars.methods.clicked ).toEqual('function')
expect(ProgressBars.methods.clicked()).toBeUndefined()
})
})