diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/finance.unit.js | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/test/finance.unit.js b/test/finance.unit.js index 8be7d2c8..ee4bfbd6 100644 --- a/test/finance.unit.js +++ b/test/finance.unit.js @@ -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 |
