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

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

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

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

  // it's also easy to check for the existence of elements
  it('has a button', () => {
    expect(wrapper.contains('button')).toBe(true);
  });
});