aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/finance.unit.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/finance.unit.js b/test/finance.unit.js
index ae9db61c..ea474f59 100644
--- a/test/finance.unit.js
+++ b/test/finance.unit.js
@@ -223,6 +223,26 @@ describe('finance.js', function () {
assert.strictEqual(typeOfAmount , "string", "the amount type should be number");
});
+ [false, undefined].forEach(function (autoFormat){
+ it(`should return unformatted if autoformat is ${autoFormat}`, function() {
+
+ const number = 6000;
+ const amount = faker.finance.amount(number, number, 0, undefined, autoFormat);
+
+ assert.strictEqual(amount, number.toString());
+ });
+ });
+
+ it("should return the number formatted on the current locale", function() {
+
+ const number = 6000, decimalPlaces = 2;
+ const expected = number.toLocaleString(undefined, {minimumFractionDigits: decimalPlaces});
+
+ const amount = faker.finance.amount(number, number, decimalPlaces, undefined, true);
+
+ assert.strictEqual(amount, expected);
+ });
+
});
describe('transactionType()', function () {