diff --git a/projects/systelab-translate/src/test/i18n.service.spec.ts b/projects/systelab-translate/src/test/i18n.service.spec.ts index 90497b0..9b99a68 100644 --- a/projects/systelab-translate/src/test/i18n.service.spec.ts +++ b/projects/systelab-translate/src/test/i18n.service.spec.ts @@ -140,6 +140,26 @@ describe('Translate Service', () => { }); }); + it('Check a key added on the fly with one parameter', (done) => { + service.use('es-ES') + .subscribe(() => { + service.setStaticBundles({ USER_AGE_AND_GENDER: 'User gender is {{USER_GENDER}}' }); + expect(service.instant('USER_AGE_AND_GENDER', {USER_GENDER: 'Male'} )) + .toBe('User gender is Male'); + done(); + }); + }); + + it('Check a key added on the fly with empty parameters', (done) => { + service.use('es-ES') + .subscribe(() => { + service.setStaticBundles({ USER_AGE_AND_GENDER: 'User gender is {{USER_GENDER}}' }); + expect(service.instant('USER_AGE_AND_GENDER', '' )) + .toBe('User gender is '); + done(); + }); + }); + it('Check a key with multiple named not sorted parameters', (done) => { service.use('es-ES') .subscribe(() => { @@ -237,6 +257,16 @@ describe('Translate Service', () => { }); }); + it('should format a number based on the decimal format', (done) => { + service.use('en-US') + .subscribe(() => { + const myNumber = 3.1; + expect(service.formatNumber(myNumber, '#.00')) + .toBe('3.10'); + done(); + }); + }); + it('should format a number based on the decimal format and locale parameters', (done) => { service.use('es-ES') .subscribe(() => {