Convert i18n tests to TypeScript
This commit is contained in:
parent
49bb1321e3
commit
06dec4fec1
2 changed files with 13 additions and 5 deletions
|
@ -109,7 +109,6 @@
|
||||||
|
|
||||||
<script type="text/javascript" src="libphonenumber_util_test.js"></script>
|
<script type="text/javascript" src="libphonenumber_util_test.js"></script>
|
||||||
<script type="text/javascript" src="reliable_trigger_test.js"></script>
|
<script type="text/javascript" src="reliable_trigger_test.js"></script>
|
||||||
<script type="text/javascript" src="i18n_test.js"></script>
|
|
||||||
<script type="text/javascript" src="stickers_test.js"></script>
|
<script type="text/javascript" src="stickers_test.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
|
@ -1,15 +1,24 @@
|
||||||
// Copyright 2017-2020 Signal Messenger, LLC
|
// Copyright 2017-2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
/* global i18n */
|
import { assert } from 'chai';
|
||||||
|
import type { LocalizerType } from '../../types/Util';
|
||||||
|
import { setupI18n } from '../../util/setupI18n';
|
||||||
|
import * as enMessages from '../../../_locales/en/messages.json';
|
||||||
|
|
||||||
|
describe('setupI18n', () => {
|
||||||
|
let i18n: LocalizerType;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
i18n = setupI18n('en', enMessages);
|
||||||
|
});
|
||||||
|
|
||||||
describe('i18n', () => {
|
|
||||||
describe('i18n', () => {
|
describe('i18n', () => {
|
||||||
it('returns empty string for unknown string', () => {
|
it('returns empty string for unknown string', () => {
|
||||||
assert.strictEqual(i18n('random'), '');
|
assert.strictEqual(i18n('random'), '');
|
||||||
});
|
});
|
||||||
it('returns message for given string', () => {
|
it('returns message for given string', () => {
|
||||||
assert.equal(i18n('reportIssue'), ['Contact Support']);
|
assert.strictEqual(i18n('reportIssue'), 'Contact Support');
|
||||||
});
|
});
|
||||||
it('returns message with single substitution', () => {
|
it('returns message with single substitution', () => {
|
||||||
const actual = i18n('migratingToSQLCipher', ['45/200']);
|
const actual = i18n('migratingToSQLCipher', ['45/200']);
|
Loading…
Add table
Add a link
Reference in a new issue