Files
manja_ui_dev/tests/unit/views/base/Switches.spec.js
T
2019-08-10 12:07:10 +02:00

34 lines
996 B
JavaScript

import Vue from 'vue'
import { mount, shallowMount } from '@vue/test-utils';
import CoreuiVue from '@coreui/vue'
import Switches from '@/views/base/Switches'
Vue.use(CoreuiVue)
describe('Switches.vue', () => {
it('has a name', () => {
expect(Switches.name).toMatch('switches')
})
it('has a created hook', () => {
expect(typeof Switches.data).toMatch('function')
})
it('sets the correct default data', () => {
expect(typeof Switches.data).toMatch('function')
const defaultData = Switches.data()
expect(typeof defaultData.fields).toMatch('object')
expect(defaultData.checker).toMatch('yes')
})
it('is Vue instance', () => {
const wrapper = mount(Switches)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Switches', () => {
const wrapper = mount(Switches)
expect(wrapper.is(Switches)).toBe(true)
})
test('renders correctly', () => {
const wrapper = shallowMount(Switches)
expect(wrapper.element).toMatchSnapshot()
})
})