test: added basic unit tests (except for charts). Unit tests segregated in directories.

This commit is contained in:
woothu
2018-10-12 10:01:54 +02:00
parent 364c951ef2
commit ceee8b07ca
45 changed files with 70 additions and 2 deletions
+32
View File
@@ -0,0 +1,32 @@
import Vue from 'vue'
import { shallowMount, mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Breadcrumbs from '@/views/base/Breadcrumbs'
Vue.use(BootstrapVue)
describe('Breadcrumbs.vue', () => {
it('has a name', () => {
expect(Breadcrumbs.name).toMatch('breadcrumbs')
})
it('has a created hook', () => {
expect(typeof Breadcrumbs.data).toMatch('function')
})
it('sets the correct default data', () => {
expect(typeof Breadcrumbs.data).toMatch('function')
const defaultData = Breadcrumbs.data()
expect(typeof defaultData.items).toMatch('object')
})
it('is Vue instance', () => {
const wrapper = shallowMount(Breadcrumbs)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Breadcrumbs', () => {
const wrapper = shallowMount(Breadcrumbs)
expect(wrapper.is(Breadcrumbs)).toBe(true)
})
it('should render correct content', () => {
const wrapper = mount(Breadcrumbs)
expect(wrapper.find('header.card-header > div > strong').text()).toMatch('Bootstrap Breadcrumb')
})
})
+32
View File
@@ -0,0 +1,32 @@
import Vue from 'vue'
import { shallowMount, mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Cards from '@/views/base/Cards'
Vue.use(BootstrapVue)
describe('Cards.vue', () => {
it('has a name', () => {
expect(Cards.name).toMatch('cards')
})
it('has a created hook', () => {
expect(typeof Cards.data).toMatch('function')
})
it('sets the correct default data', () => {
expect(typeof Cards.data).toMatch('function')
const defaultData = Cards.data()
expect(defaultData.show).toBe(true)
})
it('is Vue instance', () => {
const wrapper = shallowMount(Cards)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Cards', () => {
const wrapper = shallowMount(Cards)
expect(wrapper.is(Cards)).toBe(true)
})
it('should render correct content', () => {
const wrapper = mount(Cards)
expect(wrapper.find('div.card-header > div').text()).toMatch('Card title')
})
})
+32
View File
@@ -0,0 +1,32 @@
import Vue from 'vue'
import { shallowMount, mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Carousels from '@/views/base/Carousels'
Vue.use(BootstrapVue)
describe('Carousels.vue', () => {
it('has a name', () => {
expect(Carousels.name).toMatch('carousels')
})
it('has a created hook', () => {
expect(typeof Carousels.data).toMatch('function')
})
it('sets the correct default data', () => {
expect(typeof Carousels.data).toMatch('function')
const defaultData = Carousels.data()
expect(defaultData.slide).toBe(0)
})
it('is Vue instance', () => {
const wrapper = shallowMount(Carousels)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Carousels', () => {
const wrapper = shallowMount(Carousels)
expect(wrapper.is(Carousels)).toBe(true)
})
it('should render correct content', () => {
const wrapper = mount(Carousels)
expect(wrapper.find('header.card-header > div > strong').text()).toMatch('Bootstrap Carousel')
})
})
+32
View File
@@ -0,0 +1,32 @@
import Vue from 'vue'
import { shallowMount, mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Collapses from '@/views/base/Collapses'
Vue.use(BootstrapVue)
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')
})
})
+32
View File
@@ -0,0 +1,32 @@
import Vue from 'vue'
import { shallowMount, mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Forms from '@/views/base/Forms'
Vue.use(BootstrapVue)
describe('Forms.vue', () => {
it('has a name', () => {
expect(Forms.name).toMatch('forms')
})
it('has a created hook', () => {
expect(typeof Forms.data).toMatch('function')
})
it('sets the correct default data', () => {
expect(typeof Forms.data).toMatch('function')
const defaultData = Forms.data()
expect(defaultData.show).toBe(true)
})
it('is Vue instance', () => {
const wrapper = shallowMount(Forms)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Forms', () => {
const wrapper = shallowMount(Forms)
expect(wrapper.is(Forms)).toBe(true)
})
it('should render correct content', () => {
const wrapper = mount(Forms)
expect(wrapper.find('div.card-header > div > strong').text()).toMatch('Credit Card')
})
})
+24
View File
@@ -0,0 +1,24 @@
import Vue from 'vue'
import { shallowMount, mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Jumbotrons from '@/views/base/Jumbotrons'
Vue.use(BootstrapVue)
describe('Jumbotrons.vue', () => {
it('has a name', () => {
expect(Jumbotrons.name).toMatch('jumbotrons')
})
it('is Vue instance', () => {
const wrapper = shallowMount(Jumbotrons)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Jumbotrons', () => {
const wrapper = shallowMount(Jumbotrons)
expect(wrapper.is(Jumbotrons)).toBe(true)
})
it('should render correct content', () => {
const wrapper = mount(Jumbotrons)
expect(wrapper.find('header.card-header > div > strong').text()).toMatch('Bootstrap Jumbotron')
})
})
+24
View File
@@ -0,0 +1,24 @@
import Vue from 'vue'
import { shallowMount, mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import ListGroups from '@/views/base/ListGroups'
Vue.use(BootstrapVue)
describe('ListGroups.vue', () => {
it('has a name', () => {
expect(ListGroups.name).toMatch('list-groups')
})
it('is Vue instance', () => {
const wrapper = shallowMount(ListGroups)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is ListGroups', () => {
const wrapper = shallowMount(ListGroups)
expect(wrapper.is(ListGroups)).toBe(true)
})
it('should render correct content', () => {
const wrapper = mount(ListGroups)
expect(wrapper.find('header.card-header > div > strong').text()).toMatch('Bootstrap list group')
})
})
+24
View File
@@ -0,0 +1,24 @@
import Vue from 'vue'
import { shallowMount, mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Navbars from '@/views/base/Navbars'
Vue.use(BootstrapVue)
describe('Navbars.vue', () => {
it('has a name', () => {
expect(Navbars.name).toMatch('navbars')
})
it('is Vue instance', () => {
const wrapper = shallowMount(Navbars)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Navbars', () => {
const wrapper = shallowMount(Navbars)
expect(wrapper.is(Navbars)).toBe(true)
})
it('should render correct content', () => {
const wrapper = mount(Navbars)
expect(wrapper.find('header.card-header > div > strong').text()).toMatch('Bootstrap Navbar')
})
})
+24
View File
@@ -0,0 +1,24 @@
import Vue from 'vue'
import { shallowMount, mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Navs from '@/views/base/Navs'
Vue.use(BootstrapVue)
describe('Navs.vue', () => {
it('has a name', () => {
expect(Navs.name).toMatch('navs')
})
it('is Vue instance', () => {
const wrapper = shallowMount(Navs)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Navbars', () => {
const wrapper = shallowMount(Navs)
expect(wrapper.is(Navs)).toBe(true)
})
it('should render correct content', () => {
const wrapper = mount(Navs)
expect(wrapper.find('header.card-header > div > strong').text()).toMatch('Bootstrap Navs')
})
})
+32
View File
@@ -0,0 +1,32 @@
import Vue from 'vue'
import { shallowMount, mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Paginations from '@/views/base/Paginations'
Vue.use(BootstrapVue)
describe('Paginations.vue', () => {
it('has a name', () => {
expect(Paginations.name).toMatch('paginations')
})
it('has a created hook', () => {
expect(typeof Paginations.data).toMatch('function')
})
it('sets the correct default data', () => {
expect(typeof Paginations.data).toMatch('function')
const defaultData = Paginations.data()
expect(defaultData.currentPage).toBe(3)
})
it('is Vue instance', () => {
const wrapper = shallowMount(Paginations)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Paginations', () => {
const wrapper = shallowMount(Paginations)
expect(wrapper.is(Paginations)).toBe(true)
})
it('should render correct content', () => {
const wrapper = mount(Paginations)
expect(wrapper.find('header.card-header > div > strong').text()).toMatch('Bootstrap Pagination')
})
})
+32
View File
@@ -0,0 +1,32 @@
import Vue from 'vue'
import { mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Popovers from '@/views/base/Popovers'
Vue.use(BootstrapVue)
describe('Popovers.vue', () => {
it('has a name', () => {
expect(Popovers.name).toMatch('popovers')
})
it('has a created hook', () => {
expect(typeof Popovers.data).toMatch('function')
})
it('sets the correct default data', () => {
expect(typeof Popovers.data).toMatch('function')
const defaultData = Popovers.data()
expect(defaultData.show).toBe(false)
})
it('is Vue instance', () => {
const wrapper = mount(Popovers)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Popovers', () => {
const wrapper = mount(Popovers)
expect(wrapper.is(Popovers)).toBe(true)
})
it('should render correct content', () => {
const wrapper = mount(Popovers)
expect(wrapper.find('header.card-header > div > strong').text()).toMatch('Bootstrap Popovers')
})
})
+32
View File
@@ -0,0 +1,32 @@
import Vue from 'vue'
import { mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import ProgressBars from '@/views/base/ProgressBars'
Vue.use(BootstrapVue)
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')
const defaultData = ProgressBars.data()
expect(defaultData.counter).toBe(45)
})
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)
})
it('should render correct content', () => {
const wrapper = mount(ProgressBars)
expect(wrapper.find('header.card-header > div > strong').text()).toMatch('Bootstrap Progress')
})
})
+33
View File
@@ -0,0 +1,33 @@
import Vue from 'vue'
import { mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Switches from '@/views/base/Switches'
Vue.use(BootstrapVue)
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)
})
it('should render correct content', () => {
const wrapper = mount(Switches)
expect(wrapper.find('div.card-header > div').text()).toMatch('Switch default')
})
})
+32
View File
@@ -0,0 +1,32 @@
import Vue from 'vue'
import { mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Table from '@/views/base/Table'
Vue.use(BootstrapVue)
describe('Table.vue', () => {
it('has a name', () => {
expect(Table.name).toMatch('c-table')
})
it('has a created hook', () => {
expect(typeof Table.data).toMatch('function')
})
it('sets the correct default data', () => {
expect(typeof Table.data).toMatch('function')
const defaultData = Table.data()
expect(defaultData.currentPage).toBe(1)
})
it('is Vue instance', () => {
const wrapper = mount(Table)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Table', () => {
const wrapper = mount(Table)
expect(wrapper.is(Table)).toBe(true)
})
it('should render correct content', () => {
const wrapper = mount(Table)
expect(wrapper.find('div.card-header > div').text()).toMatch('Table')
})
})
+24
View File
@@ -0,0 +1,24 @@
import Vue from 'vue'
import { mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Tables from '@/views/base/Tables'
Vue.use(BootstrapVue)
describe('Tables.vue', () => {
it('has a name', () => {
expect(Tables.name).toMatch('tables')
})
it('is Vue instance', () => {
const wrapper = mount(Tables)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Tables', () => {
const wrapper = mount(Tables)
expect(wrapper.is(Tables)).toBe(true)
})
it('should render correct content', () => {
const wrapper = mount(Tables)
expect(wrapper.find('div.card-header > div').text()).toMatch('Simple Table')
})
})
+33
View File
@@ -0,0 +1,33 @@
import Vue from 'vue'
import { mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Tabs from '@/views/base/Tabs'
Vue.use(BootstrapVue)
describe('Tabs.vue', () => {
it('has a name', () => {
expect(Tabs.name).toMatch('tabs')
})
it('has a created hook', () => {
expect(typeof Tabs.data).toMatch('function')
})
it('sets the correct default data', () => {
expect(typeof Tabs.data).toMatch('function')
const defaultData = Tabs.data()
expect(defaultData.tabs).toEqual(["Calculator", "Shopping cart", "Charts"])
expect(defaultData.tabIndex).toEqual([0, 0])
})
it('is Vue instance', () => {
const wrapper = mount(Tabs)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Tabs', () => {
const wrapper = mount(Tabs)
expect(wrapper.is(Tabs)).toBe(true)
})
it('should render correct content', () => {
const wrapper = mount(Tabs)
expect(wrapper.find('div.card-header > div').text()).toMatch('Tabs')
})
})
+33
View File
@@ -0,0 +1,33 @@
import Vue from 'vue'
import { mount } from '@vue/test-utils'
import BootstrapVue from 'bootstrap-vue'
import Tooltips from '@/views/base/Tooltips'
Vue.use(BootstrapVue)
describe('Tooltips.vue', () => {
it('has a name', () => {
expect(Tooltips.name).toMatch('tooltips')
})
it('has a created hook', () => {
expect(typeof Tooltips.data).toMatch('function')
})
it('sets the correct default data', () => {
expect(typeof Tooltips.data).toMatch('function')
const defaultData = Tooltips.data()
expect(defaultData.show).toBe(true)
expect(defaultData.disabled).toBe(false)
})
it('is Vue instance', () => {
const wrapper = mount(Tooltips)
expect(wrapper.isVueInstance()).toBe(true)
})
it('is Tooltips', () => {
const wrapper = mount(Tooltips)
expect(wrapper.is(Tooltips)).toBe(true)
})
it('should render correct content', () => {
const wrapper = mount(Tooltips)
expect(wrapper.find('header.card-header > div > strong').text()).toMatch('Bootstrap Tooltips')
})
})