Skip to content

Commit

Permalink
fix(vue): ootb unit testing should work with --routing #19921
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed May 16, 2024
1 parent c7f60fc commit 47e446b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ import { mount } from '@vue/test-utils';
import App from './App.vue';
describe('App', () => {
it('renders properly', () => {
it('renders properly', async () => {
const wrapper = mount(App, {});
expect(wrapper.text()).toContain('Welcome test 👋');
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<% if ( unitTestRunner === 'vitest' ) { %>
import { describe, it, expect } from 'vitest'
<% } %><% if( routing ) { %>
import router from '../router';
<% } %>
import { mount } from '@vue/test-utils'
import App from './App.vue';

describe('App', () => {
it('renders properly', () => {
const wrapper = mount(App, {})
it('renders properly', async () => {
const wrapper = mount(App, <% if( routing ) { %>{ global: { plugins: [router] }}<% } else { %>{}<% } %>)
<% if( routing ) { %>
await router.isReady();
<% } %>
expect(wrapper.text()).toContain('Welcome <%= title %> 👋')
})
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import NxWelcome from '../app/NxWelcome.vue'

<template>
<main>
<NxWelcome />
<NxWelcome title="<%= title %>" />
</main>
</template>

0 comments on commit 47e446b

Please sign in to comment.