aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMartin Parsiegla <[email protected]>2020-09-01 19:13:58 +0200
committerMartin Parsiegla <[email protected]>2020-09-01 19:19:07 +0200
commit8820484e159bead9be36d200f181302e2a45636e (patch)
tree7c07f1222dc214247abc4a7937fa9c2b2965f80e /test
parentecac64c468f486f45144a2fe18837dab334b74ac (diff)
downloadfaker-8820484e159bead9be36d200f181302e2a45636e.tar.xz
faker-8820484e159bead9be36d200f181302e2a45636e.zip
Add optional country code parameter for iban method
Diffstat (limited to 'test')
-rw-r--r--test/finance.unit.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/finance.unit.js b/test/finance.unit.js
index f8a9b133..822b7fd1 100644
--- a/test/finance.unit.js
+++ b/test/finance.unit.js
@@ -352,6 +352,17 @@ describe('finance.js', function () {
assert.equal(ibanLib.mod97(ibanLib.toDigitString(bban)), 1, "the result should be equal to 1");
});
+ it("returns a specific and formally correct IBAN number", function () {
+ var iban = faker.finance.iban(false, "DE");
+ var bban = iban.substring(4) + iban.substring(0, 4);
+ var countryCode = iban.substring(0, 2);
+
+ assert.equal(countryCode, "DE");
+ assert.equal(ibanLib.mod97(ibanLib.toDigitString(bban)), 1, "the result should be equal to 1");
+ });
+ it("throws an error if the passed country code is not supported", function () {
+ assert.throws(function() { faker.finance.iban(false, 'AA');}, /Country code AA not supported/);
+ });
});
describe("bic()", function () {