RTL
This commit is contained in:
parent
1f2cde6d04
commit
0e490542a7
196 changed files with 2117 additions and 1217 deletions
|
@ -2,17 +2,8 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
import { stub } from 'sinon';
|
||||
import { load } from '../../../app/locale';
|
||||
import type { LoggerType } from '../../types/Logging';
|
||||
|
||||
const logger: Pick<LoggerType, 'info' | 'warn'> = {
|
||||
info(..._args: Array<unknown>) {
|
||||
// noop
|
||||
},
|
||||
warn(..._args: Array<unknown>) {
|
||||
throw new Error(String(_args));
|
||||
},
|
||||
};
|
||||
|
||||
describe('locale', async () => {
|
||||
describe('load', () => {
|
||||
|
@ -21,7 +12,17 @@ describe('locale', async () => {
|
|||
preferredSystemLocales: Array<string>,
|
||||
expectedLocale: string
|
||||
) {
|
||||
const actualLocale = await load({ preferredSystemLocales, logger });
|
||||
const actualLocale = await load({
|
||||
preferredSystemLocales,
|
||||
logger: {
|
||||
fatal: stub().throwsArg(0),
|
||||
error: stub().throwsArg(0),
|
||||
warn: stub().throwsArg(0),
|
||||
info: stub(),
|
||||
debug: stub(),
|
||||
trace: stub(),
|
||||
},
|
||||
});
|
||||
assert.strictEqual(actualLocale.name, expectedLocale);
|
||||
}
|
||||
|
||||
|
|
|
@ -199,12 +199,12 @@ describe('createTemplate', () => {
|
|||
const { i18n } = loadLocale({
|
||||
preferredSystemLocales: ['en'],
|
||||
logger: {
|
||||
info(_arg: unknown) {
|
||||
// noop
|
||||
},
|
||||
warn(arg: unknown) {
|
||||
throw new Error(String(arg));
|
||||
},
|
||||
fatal: stub().throwsArg(0),
|
||||
error: stub().throwsArg(0),
|
||||
warn: stub().throwsArg(0),
|
||||
info: stub(),
|
||||
debug: stub(),
|
||||
trace: stub(),
|
||||
},
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue