diff options
| author | Luiz Strobelt <[email protected]> | 2020-10-01 01:14:54 -0300 |
|---|---|---|
| committer | Luiz Strobelt <[email protected]> | 2020-10-01 01:14:54 -0300 |
| commit | d6ee1c544f33722852b024994d150cd4703b0972 (patch) | |
| tree | 07bb50596d7fb9ba9a1274744c1a663cb17b8398 /test | |
| parent | 5df3678f842383855c53a4c14d39a20deb64f7cc (diff) | |
| download | faker-d6ee1c544f33722852b024994d150cd4703b0972.tar.xz faker-d6ee1c544f33722852b024994d150cd4703b0972.zip | |
Add auto formatting to finance.amount
Diffstat (limited to 'test')
| -rw-r--r-- | test/finance.unit.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/finance.unit.js b/test/finance.unit.js index 8935eaaa..79ac26db 100644 --- a/test/finance.unit.js +++ b/test/finance.unit.js @@ -150,7 +150,7 @@ describe('finance.js', function () { }); - describe('amount(min, max, dec, symbol)', function () { + describe.only('amount(min, max, dec, symbol)', function () { it("should use the default amounts when not passing arguments", function () { var amount = faker.finance.amount(); @@ -223,6 +223,20 @@ describe('finance.js', function () { assert.strictEqual(typeOfAmount , "string", "the amount type should be number"); }); + it("should return unformatted if autoformat i false", function() { + + }); + + it("should return with a comma separator", function() { + + const symbol = "$", number = 6000, decimalPlaces = 2; + const expected = symbol + number.toLocaleString(undefined, {minimumFractionDigits: decimalPlaces}); + + const amount = faker.finance.amount(number, number, decimalPlaces, symbol, true); + + assert.strictEqual(amount, expected); + }); + }); describe('transactionType()', function () { |
