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