Skip to content

Commit b9a109c

Browse files
authored
test: add example fixture with @nuxtjs/i18n (#633)
1 parent 705e2aa commit b9a109c

File tree

7 files changed

+519
-152
lines changed

7 files changed

+519
-152
lines changed

examples/i18n/app.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<template>
2+
<div>
3+
Hi from @nuxtjs/i18n: {{ (('hello')) }}
4+
</div>
5+
</template>

examples/i18n/nuxt.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// https://nuxt.com/docs/api/configuration/nuxt-config
2+
export default defineNuxtConfig({
3+
devtools: { enabled: true },
4+
modules: ['@nuxtjs/i18n']
5+
})

examples/i18n/package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "nuxt-app",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"build": "nuxt build",
7+
"dev": "nuxt dev",
8+
"generate": "nuxt generate",
9+
"preview": "nuxt preview",
10+
"test": "vitest run",
11+
"postinstall": "nuxt prepare"
12+
},
13+
"devDependencies": {
14+
"@nuxt/devtools": "latest",
15+
"@nuxt/test-utils": "latest",
16+
"@nuxtjs/i18n": "8.0.0-rc.7",
17+
"nuxt": "^3.8.2",
18+
"vitest": "1.0.1",
19+
"vue": "^3.3.10",
20+
"vue-router": "^4.2.5"
21+
}
22+
}

examples/i18n/test/index.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { describe, expect, it } from 'vitest'
2+
3+
import { mountSuspended } from '@nuxt/test-utils/runtime'
4+
import App from '~/app.vue'
5+
6+
describe('Mounting app with `@nuxtjs/i18n`', () => {
7+
it('can mount some component', async () => {
8+
const component = await mountSuspended(App)
9+
expect(component.vm).toBeTruthy()
10+
expect(component.text()).toMatchInlineSnapshot(
11+
`"Hi from @nuxtjs/i18n: hello"`
12+
)
13+
})
14+
})

examples/i18n/tsconfig.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
// https://nuxt.com/docs/guide/concepts/typescript
3+
"extends": "./.nuxt/tsconfig.json"
4+
}

examples/i18n/vitest.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineVitestConfig } from '@nuxt/test-utils/config'
2+
3+
export default defineVitestConfig({
4+
test: {
5+
environment: 'nuxt',
6+
},
7+
})

0 commit comments

Comments
 (0)