2018-11-02 11:02:53 -07:00
|
|
|
/* global i18n */
|
|
|
|
|
|
|
|
describe('i18n', () => {
|
|
|
|
describe('i18n', () => {
|
|
|
|
it('returns empty string for unknown string', () => {
|
2018-03-23 18:37:32 -07:00
|
|
|
assert.strictEqual(i18n('random'), '');
|
2017-05-15 14:48:19 -07:00
|
|
|
});
|
2018-11-02 11:02:53 -07:00
|
|
|
it('returns message for given string', () => {
|
2017-05-15 14:48:19 -07:00
|
|
|
assert.equal(i18n('reportIssue'), 'Report an issue');
|
|
|
|
});
|
2018-11-02 11:02:53 -07:00
|
|
|
it('returns message with single substitution', () => {
|
2017-05-15 14:48:19 -07:00
|
|
|
const actual = i18n('attemptingReconnection', 5);
|
2017-05-15 15:15:03 -07:00
|
|
|
assert.equal(actual, 'Attempting reconnect in 5 seconds');
|
2017-05-15 14:48:19 -07:00
|
|
|
});
|
2018-11-02 11:02:53 -07:00
|
|
|
it('returns message with multiple substitutions', () => {
|
2018-05-21 11:57:40 -07:00
|
|
|
const actual = i18n('theyChangedTheTimer', ['Someone', '5 minutes']);
|
2018-07-09 14:29:13 -07:00
|
|
|
assert.equal(
|
|
|
|
actual,
|
|
|
|
'Someone set the disappearing message timer to 5 minutes'
|
|
|
|
);
|
2017-05-15 14:48:19 -07:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-11-02 11:02:53 -07:00
|
|
|
describe('getLocale', () => {
|
|
|
|
it('returns a string with length two or greater', () => {
|
2017-05-15 14:48:19 -07:00
|
|
|
const locale = i18n.getLocale();
|
|
|
|
assert.isAtLeast(locale.trim().length, 2);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|