Test migration to jest by hand

Apparently using regular expressions is way easier.
This commit is contained in:
Angelos Chalaris
2018-06-18 15:15:56 +03:00
parent 5df7098fac
commit a78f5db260
894 changed files with 5917 additions and 3607 deletions

View File

@ -0,0 +1,3 @@
const toCurrency = (n, curr, LanguageFormat = undefined) =>
Intl.NumberFormat(LanguageFormat, { style: 'currency', currency: curr }).format(n);
module.exports = toCurrency;

View 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');