test head post/_id/_slug/index.spec.js

This commit is contained in:
Ulf Gebhardt 2021-04-26 00:34:17 +02:00
parent d151251c95
commit 44038a46ab
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD

View File

@ -4,6 +4,7 @@ import Vue from 'vue'
import PostSlug from './index.vue'
import CommentList from '~/components/CommentList/CommentList'
import HcHashtag from '~/components/Hashtag/Hashtag'
import VueMeta from 'vue-meta'
config.stubs['client-only'] = '<span><slot /></span>'
config.stubs['nuxt-link'] = '<span><slot /></span>'
@ -11,6 +12,7 @@ config.stubs['router-link'] = '<span><slot /></span>'
const localVue = global.localVue
localVue.directive('scrollTo', jest.fn())
localVue.use(VueMeta, { keyName: 'head' })
describe('PostSlug', () => {
let wrapper, Wrapper, backendData, mocks, stubs
@ -91,6 +93,11 @@ describe('PostSlug', () => {
return wrapper
}
it('has correct <head> content', async () => {
wrapper = await Wrapper()
expect(wrapper.vm.$metaInfo.title).toBe('loading')
})
describe('given author is `null`', () => {
it('does not crash', async () => {
backendData = {