head test search-results.spec.js

This commit is contained in:
Ulf Gebhardt 2021-04-26 00:36:32 +02:00
parent fc3e404ded
commit 002c9f5786
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD

View File

@ -1,7 +1,10 @@
import { config, mount } from '@vue/test-utils' import { config, mount } from '@vue/test-utils'
import searchResults from './search-results.vue' import searchResults from './search-results.vue'
import VueMeta from 'vue-meta'
const localVue = global.localVue const localVue = global.localVue
localVue.use(VueMeta, { keyName: 'head' })
config.stubs['client-only'] = '<span class="client-only"><slot /></span>' config.stubs['client-only'] = '<span class="client-only"><slot /></span>'
describe('search-results.vue', () => { describe('search-results.vue', () => {
@ -10,7 +13,7 @@ describe('search-results.vue', () => {
beforeEach(() => { beforeEach(() => {
mocks = { mocks = {
$t: jest.fn(), $t: (t) => t,
} }
}) })
@ -26,5 +29,9 @@ describe('search-results.vue', () => {
it('renders', () => { it('renders', () => {
expect(wrapper.findAll('.search-results')).toHaveLength(1) expect(wrapper.findAll('.search-results')).toHaveLength(1)
}) })
it('has correct <head> content', () => {
expect(wrapper.vm.$metaInfo.title).toBe('search.title')
})
}) })
}) })