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

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

  wrapper.setProps({
    title: 'Title',
    routes: [
      {
        path: '/',
        name: 'Home'
      }
    ]
  })

  it('check title', () => {
    expect(wrapper.html()).toContain(
      '<nuxt-link to="/" class="title-name">Title</nuxt-link>'
    )
  })

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