Skip to content

Commit

Permalink
Increased testing code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
tlainez committed Jan 31, 2022
1 parent ba7a8be commit 6b2ce4d
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions projects/systelab-translate/src/test/i18n.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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(() => {
Expand Down

0 comments on commit 6b2ce4d

Please sign in to comment.