diff options
| author | Christophe Gesché <[email protected]> | 2021-02-19 18:21:52 +0100 |
|---|---|---|
| committer | Christophe Gesché <[email protected]> | 2021-02-19 18:21:52 +0100 |
| commit | bb3e08c2d23b9a63cb56fbe06eb4972650726243 (patch) | |
| tree | 995ead45c4a01def3be64691f559db570274258d /test | |
| parent | f7c25050a43e3a20f3d62cead501a02d3bb4dd33 (diff) | |
| download | faker-bb3e08c2d23b9a63cb56fbe06eb4972650726243.tar.xz faker-bb3e08c2d23b9a63cb56fbe06eb4972650726243.zip | |
Update finance_issue.unit.js
- only uppercase char
- conslole log in english
Diffstat (limited to 'test')
| -rw-r--r-- | test/finance_issue.unit.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/test/finance_issue.unit.js b/test/finance_issue.unit.js index 4da66ebb..5b35d725 100644 --- a/test/finance_issue.unit.js +++ b/test/finance_issue.unit.js @@ -6,6 +6,7 @@ if (typeof module !== 'undefined') { function getAnIbanByCountry(countryCode) { var iban = faker.finance.iban(); var maxTry = 100000; + faker.seed(); while (maxTry && iban.substring(0, 2) != countryCode) { faker.seed(); iban = faker.finance.iban(); @@ -13,8 +14,9 @@ function getAnIbanByCountry(countryCode) { } if (maxTry === 0) { - console.log('aucun TR dans les 10000 seed, vraiment pas de bol'); + console.log('Not found with 10000 seed, vraiment pas de bol'); } + console.log(iban); return iban; } @@ -40,12 +42,11 @@ describe('finance_issue.js', function () { var ibanFormated = iban.match(/.{1,4}/g).join(" "); var bban = iban.substring(4) + iban.substring(0, 4); - assert.equal(22, iban.length, 'GE IBAN would be 22 chars length, given is ' + iban.length); - assert.ok(iban.substring(0, 2).match(/^[A-Za-z]{2}$/), iban.substring(0, 2) + ' must contains only characters in GE IBAN ' + ibanFormated); + assert.ok(iban.substring(0, 2).match(/^[A-Z]{2}$/), iban.substring(0, 2) + ' must contains only characters in GE IBAN ' + ibanFormated); assert.ok(iban.substring(2, 4).match(/^\d{2}$/), iban.substring(2, 4) + ' must contains only digit in GE IBAN ' + ibanFormated); - assert.ok(iban.substring(4, 6).match(/^[A-Za-z]{2}$/), iban.substring(4, 6) + ' must contains only characters in GE IBAN ' + ibanFormated); + assert.ok(iban.substring(4, 6).match(/^[A-Z]{2}$/), iban.substring(4, 6) + ' must contains only characters in GE IBAN ' + ibanFormated); assert.ok(iban.substring(6, 24).match(/^\d{16}$/), iban.substring(6, 24) + ' must contains only characters in GE IBAN ' + ibanFormated); assert.equal(ibanLib.mod97(ibanLib.toDigitString(bban)), 1, "the result should be equal to 1"); @@ -74,7 +75,7 @@ describe('finance_issue.js', function () { var ibanFormated = iban.match(/.{1,4}/g).join(" "); var bban = iban.substring(4) + iban.substring(0, 4); - assert.equal(24, iban.length, 'PK IBAN would be 24 chars length, given is ' + iban.length); + assert.equal(24, iban.length, 'PK IBAN would be 24 chars length, given is ' + iban.length); assert.ok(iban.substring(0, 2).match(/^[A-Z]{2}$/), iban.substring(0, 2) + ' must contains only characters in PK IBAN ' + ibanFormated); assert.ok(iban.substring(2, 4).match(/^\d{2}$/), iban.substring(2, 4) + ' must contains only digit in PK IBAN ' + ibanFormated); @@ -114,7 +115,6 @@ describe('finance_issue.js', function () { var ibanFormated = iban.match(/.{1,4}/g).join(" "); var bban = iban.substring(4) + iban.substring(0, 4); - assert.equal(26, iban.length, 'PK IBAN would be 26 chars length, given is ' + iban.length); assert.ok(iban.substring(0, 2).match(/^[A-Z]{2}$/), 'Country Code:' + iban.substring(0, 2) + ' must contains only characters in PK IBAN ' + ibanFormated); @@ -128,5 +128,4 @@ describe('finance_issue.js', function () { assert.equal(ibanLib.mod97(ibanLib.toDigitString(bban)), 1, "the result should be equal to 1"); }); }); - }); |
