mirror of
https://github.com/wahyd4/vuepress.git
synced 2026-08-11 06:16:08 +10:00
33 lines
824 B
JavaScript
33 lines
824 B
JavaScript
import { mount, RouterLinkStub } from '@vue/test-utils'
|
|
import createLocalVue from '@vuepress/test-utils/createLocalVue'
|
|
import NavLink from '../../components/NavLink.vue'
|
|
|
|
describe('NavLink', () => {
|
|
test('renders nav link with internal link', () => {
|
|
const item = {
|
|
link: '/',
|
|
text: 'VuePress'
|
|
}
|
|
const wrapper = mount(NavLink, {
|
|
localVue: createLocalVue(),
|
|
stubs: {
|
|
'router-link': RouterLinkStub
|
|
},
|
|
propsData: { item }
|
|
})
|
|
expect(wrapper.html()).toMatchSnapshot()
|
|
})
|
|
|
|
test('renders nav link with external link', () => {
|
|
const item = {
|
|
link: 'http://vuejs.org/',
|
|
text: 'Vue'
|
|
}
|
|
const wrapper = mount(NavLink, {
|
|
localVue: createLocalVue(),
|
|
propsData: { item }
|
|
})
|
|
expect(wrapper.html()).toMatchSnapshot()
|
|
})
|
|
})
|