Files
30-seconds-of-code/test/toCurrency/toCurrency.test.js
2018-02-08 16:09:39 +02:00

19 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const test = require('tape');
const toCurrency = require('./toCurrency.js');
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();
});