aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLukazovic <[email protected]>2020-09-06 10:47:47 -0300
committerLukazovic <[email protected]>2020-09-06 10:47:47 -0300
commit30bc715bb8a8bdb7a945c8eb01e847568eb5e7fe (patch)
tree847d4ad0ee9661a74e9826046a2eb7a65acf1a95 /test
parent81f1adf754a815b3f6fa10ec8c577572206f3c71 (diff)
downloadfaker-30bc715bb8a8bdb7a945c8eb01e847568eb5e7fe.tar.xz
faker-30bc715bb8a8bdb7a945c8eb01e847568eb5e7fe.zip
Fix return of finance.amount to string
Diffstat (limited to 'test')
-rw-r--r--test/finance.unit.js19
1 files changed, 9 insertions, 10 deletions
diff --git a/test/finance.unit.js b/test/finance.unit.js
index f8a9b133..8935eaaa 100644
--- a/test/finance.unit.js
+++ b/test/finance.unit.js
@@ -161,19 +161,18 @@ describe('finance.js', function () {
});
- /*
- Remark: This needs to be fixed now see: https://github.com/Marak/faker.js/issues/984
it("should use the default decimal location when not passing arguments", function () {
- var amount = faker.finance.amount().toString();
+ var amount = faker.finance.amount();
var decimal = '.';
var expected = amount.length - 3;
- var actual = amount.indexOf(decimal);
+ var amount = faker.finance.amount(100, 100, 1);
- assert.equal(actual, expected, 'The expected location of the decimal is ' + expected + ' but it was ' + actual + ' amount ' + amount);
+ assert.ok(amount);
+ assert.strictEqual(amount , '100.0', "the amount should be equal 100.0");
});
- */
+
//TODO: add support for more currency and decimal options
it("should not include a currency symbol by default", function () {
@@ -203,7 +202,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 () {
@@ -211,17 +210,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() {
+ it("it should return a string", 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");
+ assert.strictEqual(typeOfAmount , "string", "the amount type should be number");
});
});