Add tests for toCurrency

This commit is contained in:
Angelos Chalaris
2018-02-08 16:09:39 +02:00
parent bd0f6c1625
commit 1b2ab92afb
8 changed files with 28 additions and 14 deletions

View File

@ -12,7 +12,7 @@ test('Testing functionName', (t) => {
t.true(typeof functionName === 'function', 'functionName is a Function');
functionName(Math.max);
t.equal(output, 'max', 'Works for native functions');
function fun(x) {return x};
function fun(x) {return x;}
functionName(fun);
t.equal(output, 'fun', 'Works for functions');
const fn = x => x;

View File

@ -1,4 +1,4 @@
Test log for: Thu Feb 08 2018 15:59:54 GMT+0200 (GTB Standard Time)
Test log for: Thu Feb 08 2018 16:08:45 GMT+0200 (GTB Standard Time)
> 30-seconds-of-code@0.0.1 test G:\My Files\git Repositories\30-seconds-of-code
> tape test/**/*.test.js | tap-spec
@ -1490,6 +1490,9 @@ Test log for: Thu Feb 08 2018 15:59:54 GMT+0200 (GTB Standard Time)
Testing toCurrency
√ toCurrency is a Function
√ currency: Euro | currencyLangFormat: Local
√ currency: US Dollar | currencyLangFormat: English (United States)
√ currency: Japanese Yen | currencyLangFormat: Local
Testing toDecimalMark
@ -1754,8 +1757,8 @@ Test log for: Thu Feb 08 2018 15:59:54 GMT+0200 (GTB Standard Time)
√ Works with multiple promises
total: 852
passing: 852
total: 855
passing: 855
duration: 2.4s

View File

@ -5,9 +5,14 @@ test('Testing toCurrency', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof toCurrency === 'function', 'toCurrency is a 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(123456.789, 'USD', 'fa'), '۱۲۳٬۴۵۶٫۷۹ ؜$', 'currency: US Dollar | currencyLangFormat: Farsi'); - These break in node
t.equal(toCurrency(322342436423.2435, 'JPY'), 'JP¥ 322,342,436,423', 'currency: Japanese Yen | currencyLangFormat: Local');
//t.equal(toCurrency(322342436423.2435, 'JPY', 'fi'), '322 342 436 423 ¥', 'currency: Japanese Yen | currencyLangFormat: Finnish'); - These break in node
//t.deepEqual(toCurrency(args..), 'Expected');
//t.equal(toCurrency(args..), 'Expected');
//t.false(toCurrency(args..), 'Expected');
//t.throws(toCurrency(args..), 'Expected');
t.end();
});
});