Skip to content

Commit

Permalink
test: LDP-2498: Add i18n test with serverApiProxy enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
vloss3 committed Apr 30, 2024
1 parent 1200a83 commit 2b7b01b
Showing 1 changed file with 43 additions and 0 deletions.
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')
})
})

0 comments on commit 2b7b01b

Please sign in to comment.