about summary refs log tree commit diff
path: root/test/NavLink.test.js
blob: aeb16d04188dc94164f71f44581d3e7de3519c53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { shallowMount } from '@vue/test-utils'
import NavLink from '../components/NavLink'

describe('NavLink', () => {
  // Now mount the component and you have the wrapper
  const wrapper = shallowMount(NavLink)

  wrapper.setProps({ link: '/link', name: 'Link' })

  it('renders the correct markup', () => {
    expect(wrapper.html()).toContain(
      `<li class="navlink"><nuxt-link class="link" to="/link">Link</nuxt-link></li>`
    )
  })

  it('check text', () => {
    expect(wrapper.text()).toBe('Link')
  })

  it('match snapshot', () => {
    expect(wrapper.element).toMatchSnapshot()
  })
})