aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoralexpts <[email protected]>2017-02-11 09:24:12 +0300
committeralexpts <[email protected]>2017-02-11 09:24:12 +0300
commit434b3174b1cd3cf568c06aefbc2e8d000b397adf (patch)
treec64b1370e709bbf8a1442f981366b4209e209232 /test
parent1df4877133afd18c65d187475872c2c52e508803 (diff)
downloadfaker-434b3174b1cd3cf568c06aefbc2e8d000b397adf.tar.xz
faker-434b3174b1cd3cf568c06aefbc2e8d000b397adf.zip
Fix aomount and price argument dec for case = 0. Add unit tests. Minor codestyle fix.
Diffstat (limited to 'test')
-rw-r--r--test/commerce.unit.js17
-rw-r--r--test/finance.unit.js18
2 files changed, 34 insertions, 1 deletions
diff --git a/test/commerce.unit.js b/test/commerce.unit.js
index 06445e34..12b06887 100644
--- a/test/commerce.unit.js
+++ b/test/commerce.unit.js
@@ -110,6 +110,23 @@ describe("commerce.js", function() {
assert.ok(amount);
assert.equal((amount == 0.00), true, "the amount should equal 0");
});
+
+ it("it should handle argument dec", function () {
+
+ var price = faker.commerce.price(100, 100, 1);
+
+ assert.ok(price);
+ assert.strictEqual(price , '100.0', "the price should be equal 100.0");
+ });
+
+ it("it should handle argument dec = 0", function () {
+
+ var price = faker.commerce.price(100, 100, 0);
+
+ assert.ok(price);
+ assert.strictEqual(price , '100', "the price should be equal 100");
+ });
+
});
}); \ No newline at end of file
diff --git a/test/finance.unit.js b/test/finance.unit.js
index 6bbb51c6..22461f22 100644
--- a/test/finance.unit.js
+++ b/test/finance.unit.js
@@ -184,6 +184,22 @@ describe('finance.js', function () {
});
+ it("it should handle argument dec", function () {
+
+ var amount = faker.finance.amount(100, 100, 1);
+
+ assert.ok(amount);
+ assert.strictEqual(amount , '100.0', "the amount should be equal 100.0");
+ });
+
+ it("it should handle argument dec = 0", function () {
+
+ var amount = faker.finance.amount(100, 100, 0);
+
+ assert.ok(amount);
+ assert.strictEqual(amount , '100', "the amount should be equal 100");
+ });
+
});
describe('transactionType()', function () {
@@ -201,7 +217,7 @@ describe('finance.js', function () {
assert.ok(currencyCode.match(/[A-Z]{3}/));
});
- })
+ });
describe("bitcoinAddress()", function(){
it("returns a random bitcoin address", function(){