aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarak <[email protected]>2017-02-09 23:43:25 -0500
committerMarak <[email protected]>2017-02-09 23:43:25 -0500
commitc4dcdfb23dda1c0ad71e16870f9caf2dc14fc034 (patch)
tree15aa126c36c5418b58e0c461fc928e47e985cb36 /test
parentfa99a52296fd6de8499a8bd8b429db3c21b66862 (diff)
parent94b65cbf334ea5ef1c4838711bc0945125f7c779 (diff)
downloadfaker-c4dcdfb23dda1c0ad71e16870f9caf2dc14fc034.tar.xz
faker-c4dcdfb23dda1c0ad71e16870f9caf2dc14fc034.zip
Merge remote-tracking branch 'codemanx/master'
Diffstat (limited to 'test')
-rw-r--r--test/finance.unit.js32
1 files changed, 26 insertions, 6 deletions
diff --git a/test/finance.unit.js b/test/finance.unit.js
index 6bbb51c6..ee4bfbd6 100644
--- a/test/finance.unit.js
+++ b/test/finance.unit.js
@@ -58,7 +58,7 @@ describe('finance.js', function () {
});
- describe('mask( length, parens, elipsis )', function () {
+ describe('mask( length, parens, ellipsis )', function () {
it("should set a default length", function () {
var expected = 4; //default account mask length
@@ -111,7 +111,7 @@ describe('finance.js', function () {
});
- it("should by default include an elipsis", function () {
+ it("should by default include an ellipsis", function () {
var expected = true;
@@ -127,10 +127,10 @@ describe('finance.js', function () {
it("should work when random variables are passed into the arguments", function () {
var length = faker.random.number(20);
- var elipsis = (length % 2 === 0) ? true : false;
- var parens = !elipsis;
+ var ellipsis = (length % 2 === 0) ? true : false;
+ var parens = !ellipsis;
- var mask = faker.finance.mask(length, elipsis, parens);
+ var mask = faker.finance.mask(length, ellipsis, parens);
assert.ok(mask);
});
@@ -201,7 +201,7 @@ describe('finance.js', function () {
assert.ok(currencyCode.match(/[A-Z]{3}/));
});
- })
+ });
describe("bitcoinAddress()", function(){
it("returns a random bitcoin address", function(){
@@ -210,4 +210,24 @@ describe('finance.js', function () {
assert.ok(bitcoinAddress.match(/^[A-Z0-9.]{27,34}$/));
});
});
+
+ describe("iban()", function () {
+ var ibanLib = require('../lib/iban');
+ it("returns a random yet formally correct IBAN number", function () {
+ var iban = faker.finance.iban();
+ var bban = iban.substring(4) + iban.substring(0, 4);
+
+ assert.equal(ibanLib.mod97(ibanLib.toDigitString(bban)), 1, "the result should be equal to 1");
+ });
+ });
+
+ describe("bic()", function () {
+ var ibanLib = require('../lib/iban');
+ it("returns a random yet formally correct BIC number", function () {
+ var bic = faker.finance.bic();
+ var expr = new RegExp("^[A-Z]{4}(" + ibanLib.iso3166.join("|") + ")[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3})?$", "i");
+
+ assert.ok(bic.match(expr));
+ });
+ });
}); \ No newline at end of file