You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-desktop/ts/test/session/unit/utils/i18n/getMessage_test.ts

28 lines
953 B
TypeScript

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck - TODO: add generic type to setupI18n to fix this
import { expect } from 'chai';
import { initI18n } from './util';
describe('getMessage', () => {
it('returns the message for a token', () => {
const message = initI18n()('searchContacts');
expect(message).to.equal('Search Contacts');
});
it('returns the message for a plural token', () => {
const message = initI18n()('searchMatches', { count: 1, found_count: 2 });
expect(message).to.equal('2 of 1 match');
});
it('returns the message for a token with no args', () => {
const message = initI18n()('adminPromote');
expect(message).to.equal('Promote Admins');
});
it('returns the message for a token with a tag and args', () => {
const message = initI18n()('adminPromotedToAdmin', { name: 'Alice' });
expect(message).to.equal('<b>Alice</b> was promoted to Admin.');
});
});