2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-06 01:22:24 +03:00

chore: also add the new test files

This commit is contained in:
pimlie
2019-02-11 12:40:52 +01:00
parent 93fb27a694
commit 3cea72bdc7
2 changed files with 70 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
import { mount, defaultOptions, VueMetaServerPlugin, loadVueMetaPlugin } from './utils'
jest.mock('../package.json', () => ({
version: 'test-version'
}))
describe('plugin', () => {
let Vue
beforeAll(() => (Vue = loadVueMetaPlugin()))
test('is loaded', () => {
const instance = new Vue()
expect(instance.$meta).toEqual(expect.any(Function))
})
test('component has _hasMetaInfo set to true', () => {
const Component = Vue.component('test-component', {
template: '<div>Test</div>',
[defaultOptions.keyName]: {
title: 'Hello World'
}
})
const { vm } = mount(Component, { localVue: Vue })
expect(vm._hasMetaInfo).toBe(true)
})
test('plugin sets package version', () => {
expect(VueMetaServerPlugin.version).toBe('test-version')
})
})