Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: LDP-2498: Add i18n test with serverApiProxy enabled #227

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions test/i18nWithProxy.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { fileURLToPath } from 'node:url'
import { describe, it, expect } from 'vitest'
import { setup, $fetch } from '@nuxt/test-utils'
import DrupalCe from '../'

describe('Module @nuxtjs/i18n integration works', async () => {
await setup({
rootDir: fileURLToPath(new URL('../playground', import.meta.url)),
nuxtConfig: {
modules: [
DrupalCe,
'@nuxtjs/i18n'
],
drupalCe: {
drupalBaseUrl: 'http://127.0.0.1:3001',
ceApiEndpoint: '/api',
serverApiProxy: true
},
i18n: {
locales: ['en', 'de'],
defaultLocale: 'en',
detectBrowserLanguage: false
}
},
port: 3001
})
it('language switcher renders', async () => {
const html = await $fetch('/')
expect(html).toContain('language-switcher')
})
it('switching language works', async () => {
let html = await $fetch('/')
expect(html).toContain('Welcome to your custom-elements enabled Drupal site')
html = await $fetch('/de')
expect(html).toContain('Willkommen auf Ihrer Drupal-Website mit benutzerdefinierten Elementen')
})
it('correct menu is rendered', async () => {
let html = await $fetch('/')
expect(html).toContain('Another page')
html = await $fetch('/de')
expect(html).toContain('Eine andere Seite')
})
})