test: restore and fix unit tests
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import Vue from 'vue'
|
||||
import { shallowMount, mount } from '@vue/test-utils'
|
||||
import CoreuiVue from '@coreui/vue'
|
||||
import Collapses from '@/views/base/Collapses'
|
||||
|
||||
Vue.use(CoreuiVue)
|
||||
|
||||
describe('Collapses.vue', () => {
|
||||
it('has a name', () => {
|
||||
expect(Collapses.name).toMatch('collapses')
|
||||
})
|
||||
it('has a created hook', () => {
|
||||
expect(typeof Collapses.data).toMatch('function')
|
||||
})
|
||||
it('sets the correct default data', () => {
|
||||
expect(typeof Collapses.data).toMatch('function')
|
||||
const defaultData = Collapses.data()
|
||||
expect(defaultData.showCollapse).toBe(true)
|
||||
})
|
||||
it('is Vue instance', () => {
|
||||
const wrapper = shallowMount(Collapses)
|
||||
expect(wrapper.isVueInstance()).toBe(true)
|
||||
})
|
||||
// it('is Collapses', () => {
|
||||
// const wrapper = shallowMount(Collapses)
|
||||
// expect(wrapper.is(Collapses)).toBe(true)
|
||||
// })
|
||||
// it('should render correct content', () => {
|
||||
// const wrapper = mount(Collapses)
|
||||
// expect(wrapper.find('header.card-header > div > strong').text()).toMatch('Bootstrap Collapse')
|
||||
// })
|
||||
test('renders correctly', () => {
|
||||
const wrapper = mount(Collapses)
|
||||
expect(wrapper.element).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user