about summary refs log tree commit diff
path: root/components/NavLink/NavLink.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'components/NavLink/NavLink.test.js')
-rw-r--r--components/NavLink/NavLink.test.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/components/NavLink/NavLink.test.js b/components/NavLink/NavLink.test.js
new file mode 100644
index 0000000..a5da412
--- /dev/null
+++ b/components/NavLink/NavLink.test.js
@@ -0,0 +1,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);
+  });
+});