test(i18n): cover expanded app locale set
This commit is contained in:
parent
a606f64f03
commit
71e5174082
1 changed files with 8 additions and 10 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import * as path from 'path';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { RESOLVED_APP_LOCALES } from '../../../src/features/localization/contracts';
|
||||
import { validateConfigUpdatePayload } from '../../../src/main/ipc/configValidation';
|
||||
|
||||
describe('configValidation', () => {
|
||||
|
|
@ -42,16 +43,13 @@ describe('configValidation', () => {
|
|||
}
|
||||
});
|
||||
|
||||
it.each(['ru', 'zh', 'ja', 'ko', 'es', 'hi', 'pt', 'fr', 'ar', 'bn', 'ur', 'id', 'de'] as const)(
|
||||
'accepts supported general.appLocale update %s',
|
||||
(appLocale) => {
|
||||
const result = validateConfigUpdatePayload('general', { appLocale });
|
||||
expect(result.valid).toBe(true);
|
||||
if (result.valid) {
|
||||
expect(result.data).toEqual({ appLocale });
|
||||
}
|
||||
it.each(RESOLVED_APP_LOCALES)('accepts supported general.appLocale update %s', (appLocale) => {
|
||||
const result = validateConfigUpdatePayload('general', { appLocale });
|
||||
expect(result.valid).toBe(true);
|
||||
if (result.valid) {
|
||||
expect(result.data).toEqual({ appLocale });
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('accepts system general.appLocale updates', () => {
|
||||
const result = validateConfigUpdatePayload('general', { appLocale: 'system' });
|
||||
|
|
@ -62,7 +60,7 @@ describe('configValidation', () => {
|
|||
});
|
||||
|
||||
it('rejects unsupported general.appLocale updates', () => {
|
||||
const result = validateConfigUpdatePayload('general', { appLocale: 'uk' });
|
||||
const result = validateConfigUpdatePayload('general', { appLocale: 'xx' });
|
||||
expect(result.valid).toBe(false);
|
||||
if (!result.valid) {
|
||||
expect(result.error).toContain('supported app locale');
|
||||
|
|
|
|||
Loading…
Reference in a new issue