Skip to content

Commit

Permalink
test: add example fixture with @nuxtjs/i18n (#633)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Dec 9, 2023
1 parent 705e2aa commit b9a109c
Show file tree
Hide file tree
Showing 7 changed files with 519 additions and 152 deletions.
5 changes: 5 additions & 0 deletions examples/i18n/app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div>
Hi from @nuxtjs/i18n: {{ (('hello')) }}
</div>
</template>
5 changes: 5 additions & 0 deletions examples/i18n/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true },
modules: ['@nuxtjs/i18n']
})
22 changes: 22 additions & 0 deletions examples/i18n/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "nuxt-app",
"private": true,
"type": "module",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"test": "vitest run",
"postinstall": "nuxt prepare"
},
"devDependencies": {
"@nuxt/devtools": "latest",
"@nuxt/test-utils": "latest",
"@nuxtjs/i18n": "8.0.0-rc.7",
"nuxt": "^3.8.2",
"vitest": "1.0.1",
"vue": "^3.3.10",
"vue-router": "^4.2.5"
}
}
14 changes: 14 additions & 0 deletions examples/i18n/test/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { describe, expect, it } from 'vitest'

import { mountSuspended } from '@nuxt/test-utils/runtime'
import App from '~/app.vue'

describe('Mounting app with `@nuxtjs/i18n`', () => {
it('can mount some component', async () => {
const component = await mountSuspended(App)
expect(component.vm).toBeTruthy()
expect(component.text()).toMatchInlineSnapshot(
`"Hi from @nuxtjs/i18n: hello"`
)
})
})
4 changes: 4 additions & 0 deletions examples/i18n/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json"
}
7 changes: 7 additions & 0 deletions examples/i18n/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineVitestConfig } from '@nuxt/test-utils/config'

export default defineVitestConfig({
test: {
environment: 'nuxt',
},
})
Loading

0 comments on commit b9a109c

Please sign in to comment.