about summary refs log tree commit diff
path: root/test/components/NavLink.test.js
blob: d35e6db794ea2c4b0f05e24debaa33567acb0d6e (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()
  })
})