From 11f94b386a0edc686213e34772e8d1694b0bdcdd Mon Sep 17 00:00:00 2001 From: Eduardo Moreira Date: Wed, 11 Mar 2020 13:59:57 -0300 Subject: Fix return of finance.amount --- test/finance.unit.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/finance.unit.js b/test/finance.unit.js index bad85884..f9187acd 100644 --- a/test/finance.unit.js +++ b/test/finance.unit.js @@ -160,9 +160,9 @@ describe('finance.js', function () { }); - it("should use the defaul decimal location when not passing arguments", function () { + it("should use the default decimal location when not passing arguments", function () { - var amount = faker.finance.amount(); + var amount = faker.finance.amount().toString(); var decimal = '.'; var expected = amount.length - 3; @@ -200,7 +200,7 @@ describe('finance.js', function () { var amount = faker.finance.amount(100, 100, 1); assert.ok(amount); - assert.strictEqual(amount , '100.0', "the amount should be equal 100.0"); + assert.strictEqual(amount , 100.0, "the amount should be equal 100.0"); }); it("it should handle argument dec = 0", function () { @@ -208,7 +208,17 @@ describe('finance.js', function () { var amount = faker.finance.amount(100, 100, 0); assert.ok(amount); - assert.strictEqual(amount , '100', "the amount should be equal 100"); + assert.strictEqual(amount , 100, "the amount should be equal 100"); + }); + + it("it should return a number", function() { + + var amount = faker.finance.amount(100, 100, 0); + + var typeOfAmount = typeof amount; + + assert.ok(amount); + assert.strictEqual(typeOfAmount , 'number', "the amount type should be number"); }); }); -- cgit v1.2.3