From 77b9ad9f6a10dafa3f9bf13726b11ae48ceca816 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Fri, 22 Mar 2024 00:42:40 +0400 Subject: [PATCH] Up tests --- src/i18n/index.ts | 2 +- test/specs/i18n/{index.js => index.ts} | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) rename test/specs/i18n/{index.js => index.ts} (95%) diff --git a/src/i18n/index.ts b/src/i18n/index.ts index f673002c7..231084c07 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -89,7 +89,7 @@ export default class I18nModule extends Module { hello: '...' } */ - getMessages(lang: string, opts = {}) { + getMessages(lang?: string, opts = {}) { const messages = this.config.messages!; lang && !messages[lang] && this._debug(`'${lang}' i18n lang not found`, opts); return lang ? messages[lang] : messages; diff --git a/test/specs/i18n/index.js b/test/specs/i18n/index.ts similarity index 95% rename from test/specs/i18n/index.js rename to test/specs/i18n/index.ts index 318889664..d73b0b998 100644 --- a/test/specs/i18n/index.js +++ b/test/specs/i18n/index.ts @@ -1,13 +1,14 @@ -import I18n from 'i18n'; -import Editor from 'editor'; +import I18n from '../../../src/i18n'; +import Editor from '../../../src/editor'; +import { I18nConfig } from '../../../src/i18n/config'; describe('I18n', () => { describe('Main', () => { - let obj; + let obj: I18n; let editor = new Editor(); let em = editor.getModel(); - const newModuleWithConfig = i18n => { + const newModuleWithConfig = (i18n: I18nConfig) => { const editor = new Editor({ i18n }); const em = editor.getModel(); return new I18n(em); @@ -36,7 +37,7 @@ describe('I18n', () => { obj = newModuleWithConfig({ locale, localeFallback, - detectLocale: 0, + detectLocale: false, messages: { en: { msg }, },