Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
3
test/toCurrency/toCurrency.js
Normal file
3
test/toCurrency/toCurrency.js
Normal file
@ -0,0 +1,3 @@
|
||||
const toCurrency = (n, curr, LanguageFormat = undefined) =>
|
||||
Intl.NumberFormat(LanguageFormat, { style: 'currency', currency: curr }).format(n);
|
||||
module.exports = toCurrency;
|
||||
12
test/toCurrency/toCurrency.test.js
Normal file
12
test/toCurrency/toCurrency.test.js
Normal file
@ -0,0 +1,12 @@
|
||||
const expect = require('expect');
|
||||
const toCurrency = require('./toCurrency.js');
|
||||
|
||||
|
||||
test('toCurrency is a Function', () => {
|
||||
expect(toCurrency).toBeInstanceOf(Function);
|
||||
});
|
||||
t.equal(toCurrency(123456.789, 'EUR'), '€ 123,456.79', 'currency: Euro | currencyLangFormat: Local');
|
||||
t.equal(toCurrency(123456.789, 'USD', 'en-us'), '$123,456.79', ' currency: US Dollar | currencyLangFormat: English (United States)');
|
||||
t.equal(toCurrency(322342436423.2435, 'JPY'), 'JP¥ 322,342,436,423', 'currency: Japanese Yen | currencyLangFormat: Local');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user