migration to vite/playwright
This commit is contained in:
19
tests/locale.test.js
Normal file
19
tests/locale.test.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { putLocale, t } from '../src/editor/locale.js'
|
||||
|
||||
const goodLangs = ['en', 'fr', 'de']
|
||||
|
||||
describe('locale loader', () => {
|
||||
test('falls back to English when lang is not supported', async () => {
|
||||
const result = await putLocale('xx', goodLangs)
|
||||
expect(result.langParam).toBe('en')
|
||||
expect(t('common.ok')).toBe('OK')
|
||||
})
|
||||
|
||||
test('loads explicit test locale bundle', async () => {
|
||||
const result = await putLocale('test', goodLangs)
|
||||
expect(result.langParam).toBe('test')
|
||||
expect(t('common.ok')).toBe('OK')
|
||||
expect(t('misc.powered_by')).toBe('Powered by')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user