Skip to content

Commit

Permalink
test(admin-ui): Add test for localeCurrency pipe with precision 3
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Jan 26, 2024
1 parent d6d5777 commit ba8f604
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class MockCurrencyService extends CurrencyService {
constructor(precision = 2) {
super({
serverConfig: {
moneyStrategyPrecision: 2,
moneyStrategyPrecision: precision,
},
} as any);
}
Expand Down Expand Up @@ -37,4 +37,11 @@ describe('LocaleCurrencyPipe', () => {
expect(pipe.transform(123, customCurrencyCode, LanguageCode.en)).toBe('1.23');
expect(pipe.transform(4200000, customCurrencyCode, LanguageCode.en)).toBe('42000.00');
});

it('with precision 3', async () => {
const pipe = new LocaleCurrencyPipe(new MockCurrencyService(3));
expect(pipe.transform(1, CurrencyCode.GBP, LanguageCode.en)).toBe('£0.001');
expect(pipe.transform(123, CurrencyCode.GBP, LanguageCode.en)).toBe('£0.123');
expect(pipe.transform(4200000, CurrencyCode.GBP, LanguageCode.en)).toBe('£4,200.000');
});
});

0 comments on commit ba8f604

Please sign in to comment.