2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-21 00:40:34 +03:00

chore: add separate tests for server and browser plugin

This commit is contained in:
pimlie
2019-02-11 12:40:00 +01:00
parent 02e4094a35
commit 93fb27a694
3 changed files with 17 additions and 36 deletions
+10 -4
View File
@@ -1,6 +1,7 @@
import { mount, createLocalVue } from '@vue/test-utils'
import { renderToString } from '@vue/server-test-utils'
import VueMetaPlugin from '../../src'
import VueMetaBrowserPlugin from '../../src/browser'
import VueMetaServerPlugin from '../../src'
import {
keyName,
@@ -14,7 +15,8 @@ import {
export {
mount,
renderToString,
VueMetaPlugin
VueMetaBrowserPlugin,
VueMetaServerPlugin
}
export const defaultOptions = {
@@ -30,8 +32,12 @@ export function getVue() {
return createLocalVue()
}
export function loadVueMetaPlugin(options, localVue = getVue()) {
localVue.use(VueMetaPlugin, Object.assign({}, defaultOptions, options))
export function loadVueMetaPlugin(browser, options, localVue = getVue()) {
if (browser) {
localVue.use(VueMetaBrowserPlugin, Object.assign({}, defaultOptions, options))
} else {
localVue.use(VueMetaServerPlugin, Object.assign({}, defaultOptions, options))
}
return localVue
}