-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: LDP-2498: Add i18n test with serverApiProxy enabled
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 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 |
---|---|---|
@@ -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') | ||
}) | ||
}) |