-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add example of mocking nuxt
useRoute
- Loading branch information
Showing
3 changed files
with
11 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<script lang="ts" setup> | ||
import { useRoute } from 'vue-router' | ||
import { useRoute as useNuxtRoute } from '#imports' | ||
const route = useRoute() | ||
const nuxtRoute = useNuxtRoute() | ||
</script> | ||
|
||
<template> | ||
<div>Index page, path: {{ route.path }}</div> | ||
<div>Index page, path: {{ route.path }}, {{ nuxtRoute.path }}</div> | ||
</template> |
2 changes: 1 addition & 1 deletion
2
examples/app-vitest-full/tests/nuxt/__snapshots__/mock-vue-router.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`Index > should render correctly 1`] = `"<div>Index page, path: /123</div>"`; | ||
exports[`Index > should render correctly 1`] = `"<div>Index page, path: /123, /bob</div>"`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters