feat: unit tests for utils (#92)
* init * get unit test working for course.ts file * added some other tests * tests halfway + change config to accomodate js files * utility functions tests done * fix: config file + miscellaneous fixes * fix: prepare script * fix lock file --------- Co-authored-by: Rotimi Best <best@classroomio.com>
This commit is contained in:
co-authored by
Rotimi Best
parent
4b2e58b1de
commit
6d689ede45
@@ -0,0 +1,27 @@
|
||||
import getCurrencyFormatter from './getCurrencyFormatter';
|
||||
|
||||
describe('GetCurrencyFormatter', () => {
|
||||
test('should return a new instance of Intl.NumberFormat with the correct locale and currency options when currency is "NGN"', () => {
|
||||
const result = getCurrencyFormatter('NGN');
|
||||
expect(result).toBeInstanceOf(Intl.NumberFormat);
|
||||
expect(result.resolvedOptions().locale).toBe('en-NG');
|
||||
expect(result.resolvedOptions().currency).toBe('NGN');
|
||||
expect(result.resolvedOptions().minimumFractionDigits).toBe(2);
|
||||
});
|
||||
|
||||
test('should return a new instance of Intl.NumberFormat with the correct locale and currency options when currency is "USD"', () => {
|
||||
const result = getCurrencyFormatter('USD');
|
||||
expect(result).toBeInstanceOf(Intl.NumberFormat);
|
||||
expect(result.resolvedOptions().locale).toBe('en-US');
|
||||
expect(result.resolvedOptions().currency).toBe('USD');
|
||||
expect(result.resolvedOptions().minimumFractionDigits).toBe(2);
|
||||
});
|
||||
|
||||
test('should return a new instance of Intl.NumberFormat with the correct locale and currency options when currency is "EUR"', () => {
|
||||
const result = getCurrencyFormatter('EUR');
|
||||
expect(result).toBeInstanceOf(Intl.NumberFormat);
|
||||
expect(result.resolvedOptions().locale).toBe('en-US');
|
||||
expect(result.resolvedOptions().currency).toBe('EUR');
|
||||
expect(result.resolvedOptions().minimumFractionDigits).toBe(2);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user