2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-06 14:52:25 +03:00
Files
vue-meta/packages/components/test/description.test.js
T
2019-06-12 14:57:34 +02:00

76 lines
1.8 KiB
JavaScript

import { renderToString } from '@vue/server-test-utils'
import * as descriptions from '../src/elements/description'
const renderOptions = {
propsData: {
value: 'test'
}
}
test('description', async () => {
const str = await renderToString(descriptions.htmlDescription, renderOptions)
expect(str).toMatchSnapshot()
})
test('og-description', async () => {
const str = await renderToString(descriptions.ogDescription, renderOptions)
expect(str).toMatchSnapshot()
})
test('twitter-description', async () => {
const str = await renderToString(descriptions.twitterDescription, renderOptions)
expect(str).toMatchSnapshot()
})
test('website-description', async () => {
const str = await renderToString(descriptions.websiteDescription, renderOptions)
expect(str).toMatchSnapshot()
})
test('description:html', async () => {
const str = await renderToString(descriptions.description, {
...renderOptions,
propsData: {
...renderOptions.propsData,
html: true
}
})
expect(str).toMatchSnapshot()
})
test('description:og', async () => {
const str = await renderToString(descriptions.description, {
...renderOptions,
propsData: {
...renderOptions.propsData,
html: false,
og: true
}
})
expect(str).toMatchSnapshot()
})
test('description:twitter', async () => {
const str = await renderToString(descriptions.description, {
...renderOptions,
propsData: {
...renderOptions.propsData,
html: false,
twitter: true
}
})
expect(str).toMatchSnapshot()
})
test('description:website', async () => {
const str = await renderToString(descriptions.description, {
...renderOptions,
propsData: {
...renderOptions.propsData,
html: false,
website: true
}
})
expect(str).toMatchSnapshot()
})