2018-11-02 18:02:53 +00:00
/* global i18n */
describe ( 'i18n' , ( ) => {
describe ( 'i18n' , ( ) => {
it ( 'returns empty string for unknown string' , ( ) => {
2018-03-24 01:37:32 +00:00
assert . strictEqual ( i18n ( 'random' ) , '' ) ;
2017-05-15 21:48:19 +00:00
} ) ;
2018-11-02 18:02:53 +00:00
it ( 'returns message for given string' , ( ) => {
2017-05-15 21:48:19 +00:00
assert . equal ( i18n ( 'reportIssue' ) , 'Report an issue' ) ;
} ) ;
2020-02-13 18:14:08 +00:00
it ( 'returns message with single substitution' , ( ) => {
const actual = i18n ( 'cannotUpdateDetail' , 'https://signal.org/download' ) ;
assert . equal (
actual ,
'Signal Desktop failed to update, but there is a new version available. Please go to https://signal.org/download and install the new version manually, then either contact support or file a bug about this problem.'
) ;
} ) ;
2018-11-02 18:02:53 +00:00
it ( 'returns message with multiple substitutions' , ( ) => {
2018-05-21 18:57:40 +00:00
const actual = i18n ( 'theyChangedTheTimer' , [ 'Someone' , '5 minutes' ] ) ;
2018-07-09 21:29:13 +00:00
assert . equal (
actual ,
'Someone set the disappearing message timer to 5 minutes'
) ;
2017-05-15 21:48:19 +00:00
} ) ;
} ) ;
2018-11-02 18:02:53 +00:00
describe ( 'getLocale' , ( ) => {
it ( 'returns a string with length two or greater' , ( ) => {
2017-05-15 21:48:19 +00:00
const locale = i18n . getLocale ( ) ;
assert . isAtLeast ( locale . trim ( ) . length , 2 ) ;
} ) ;
} ) ;
} ) ;