From fe420b9c0dc2bf19d79e64bc73272f2da46da611 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 5 Dec 2023 22:28:28 +0000 Subject: [PATCH] test: add example of importing a dynamic route --- examples/app-vitest-full/pages/other/[slug].vue | 3 +++ .../tests/nuxt/mount-component.spec.ts | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 examples/app-vitest-full/pages/other/[slug].vue create mode 100644 examples/app-vitest-full/tests/nuxt/mount-component.spec.ts diff --git a/examples/app-vitest-full/pages/other/[slug].vue b/examples/app-vitest-full/pages/other/[slug].vue new file mode 100644 index 000000000..04d85e1bd --- /dev/null +++ b/examples/app-vitest-full/pages/other/[slug].vue @@ -0,0 +1,3 @@ + diff --git a/examples/app-vitest-full/tests/nuxt/mount-component.spec.ts b/examples/app-vitest-full/tests/nuxt/mount-component.spec.ts new file mode 100644 index 000000000..a9d241a36 --- /dev/null +++ b/examples/app-vitest-full/tests/nuxt/mount-component.spec.ts @@ -0,0 +1,12 @@ +import { describe, expect, it } from 'vitest' +import { mount } from '@vue/test-utils' + +import SlugPage from '~/pages/other/[slug].vue' + +describe('mounting components', () => { + // https://github.com/nuxt/test-utils/issues/594 + it('mounts a dynamic route', async () => { + const component = mount(SlugPage) + expect(component.html()).toMatchInlineSnapshot(`"
"`) + }) +})