Skip to content

Commit 1e6b8ce

Browse files
committed
No more error warnings like "[Vue warn]: Unknown custom element: <router-link> - did you register the component correctly? For recursive components, make sure to provide the "name" option." anymore
1 parent 3e72f01 commit 1e6b8ce

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

frontend/test/components/Hello.test.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ import Hello from '@/components/Hello'
44
describe('Hello.vue', () => {
55
it('should render correct hello message', () => {
66
// Given
7-
const hellowrapped = shallowMount(Hello, { propsData: { hellomsg: 'Welcome to your Jest powered Vue.js App' } });
7+
const hellowrapped = shallowMount(Hello, {
8+
// see https://stackoverflow.com/a/37940045/4964553
9+
propsData: { hellomsg: 'Welcome to your Jest powered Vue.js App' },
10+
// see https://vue-test-utils.vuejs.org/guides/using-with-vue-router.html#testing-components-that-use-router-link-or-router-view
11+
stubs: ['router-link', 'router-view']
12+
});
13+
814
// When
915
const contentH1 = hellowrapped.find('h1');
16+
1017
// Then
1118
expect(contentH1.text()).toEqual('Welcome to your Jest powered Vue.js App');
1219
})

0 commit comments

Comments
 (0)