mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
layouts tests working
This commit is contained in:
parent
6eb5ad25af
commit
0eddfd3aa0
@ -1,10 +1,14 @@
|
|||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import { config, shallowMount } from '@vue/test-utils'
|
import { shallowMount } from '@vue/test-utils'
|
||||||
import Basic from './basic.vue'
|
import Basic from './basic.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs.nuxt = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
nuxt: {
|
||||||
|
template: '<span><slot /></span>',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
describe('basic.vue', () => {
|
describe('basic.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -28,6 +32,7 @@ describe('basic.vue', () => {
|
|||||||
store,
|
store,
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +41,7 @@ describe('basic.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('.layout-blank')).toBe(true)
|
expect(wrapper.classes('layout-blank')).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
import { config, shallowMount } from '@vue/test-utils'
|
import { shallowMount } from '@vue/test-utils'
|
||||||
import Blank from './blank.vue'
|
import Blank from './blank.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs.nuxt = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
nuxt: {
|
||||||
|
template: '<span><slot /></span>',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
describe('blank.vue', () => {
|
describe('blank.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -20,6 +24,7 @@ describe('blank.vue', () => {
|
|||||||
return shallowMount(Blank, {
|
return shallowMount(Blank, {
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +33,7 @@ describe('blank.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('.layout-blank')).toBe(true)
|
expect(wrapper.classes('layout-blank')).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,13 +1,21 @@
|
|||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import { config, shallowMount } from '@vue/test-utils'
|
import { shallowMount } from '@vue/test-utils'
|
||||||
import Default from './default.vue'
|
import Default from './default.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
localVue.directive('scrollTo', jest.fn())
|
localVue.directive('scrollTo', jest.fn())
|
||||||
|
|
||||||
config.stubs.nuxt = '<span><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
nuxt: {
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
template: '<span><slot /></span>',
|
||||||
|
},
|
||||||
|
'client-only': {
|
||||||
|
template: '<span><slot /></span>',
|
||||||
|
},
|
||||||
|
'nuxt-link': {
|
||||||
|
template: '<span><slot /></span>',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
describe('default.vue', () => {
|
describe('default.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -38,6 +46,7 @@ describe('default.vue', () => {
|
|||||||
store,
|
store,
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +55,7 @@ describe('default.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('.layout-default')).toBe(true)
|
expect(wrapper.classes('layout-default')).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
import { config, shallowMount } from '@vue/test-utils'
|
import { shallowMount } from '@vue/test-utils'
|
||||||
import Error from './error.vue'
|
import Error from './error.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'nuxt-link': {
|
||||||
|
template: '<span><slot /></span>',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
describe('error.vue', () => {
|
describe('error.vue', () => {
|
||||||
let mocks, wrapper
|
let mocks, wrapper
|
||||||
@ -15,7 +19,7 @@ describe('error.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const Wrapper = (propsData = {}) => {
|
const Wrapper = (propsData = {}) => {
|
||||||
return shallowMount(Error, { mocks, propsData, localVue })
|
return shallowMount(Error, { mocks, propsData, localVue, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('shallowMount', () => {
|
describe('shallowMount', () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user