From 8065725be88b37e5dafe66e54808773dbe5de00e Mon Sep 17 00:00:00 2001 From: Anees Ahee Date: Sun, 28 Apr 2024 03:08:43 +0100 Subject: [PATCH] Fix issue #538 - invalid Costa Rican IBAN format (#546) * Add test for Costa Rican IBAN * Update CR IBAN format in extended locale data * run gulp importLocales, excluding AR locale * Update EN locale schema snapshot --- Source/Bogus.Tests/GitHubIssues/Issue538.cs | 25 ++++++++++++++++++ Source/Bogus/data/en.locale.bson | Bin 331950 -> 331982 bytes Source/Bogus/data/en.locale.json | 8 ++++-- .../Bogus/data/en.locale.schema.verified.txt | 8 ++++-- Source/Bogus/data_extend/en.locale.json | 8 ++++-- 5 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 Source/Bogus.Tests/GitHubIssues/Issue538.cs diff --git a/Source/Bogus.Tests/GitHubIssues/Issue538.cs b/Source/Bogus.Tests/GitHubIssues/Issue538.cs new file mode 100644 index 00000000..53c8175d --- /dev/null +++ b/Source/Bogus.Tests/GitHubIssues/Issue538.cs @@ -0,0 +1,25 @@ +using Bogus.DataSets; +using FluentAssertions; +using Xunit; + +namespace Bogus.Tests.GitHubIssues; + +public class Issue538 : SeededTest +{ + [Fact] + public void can_generate_valid_costa_rican_iban() + { + // Costa Rican IBANs should match the following format: + // https://bank-code.net/iban/structure/costa-rica-international-bank-account-number + // e.g. CR05 0152 0200 1026 2840 66 + var finance = new Finance(); + var iban = finance.Iban(countryCode: "CR"); + + var countryCode = iban.Substring(0, 2); + var digitsAfterCountryCode = iban.Substring(2, 20); + + iban.Should().HaveLength(22); + countryCode.Should().Be("CR"); + digitsAfterCountryCode.Should().MatchRegex("^[0-9]{20}$"); + } +} \ No newline at end of file diff --git a/Source/Bogus/data/en.locale.bson b/Source/Bogus/data/en.locale.bson index 29ca883eab5c5d030517c5acd7074b93981d295c..5e4c99cefe0a9fba370f31b99275bfd48e3d2dca 100644 GIT binary patch delta 114 zcmZ3tP~_Y~5yo?kjIE4}TN#-Gco@%Z58`2(q|a!z{i!w6B39uI3=9lR$@!&uB}J7C z%s`HF(DeU4OzP7Q*f4QUuk>S*pDu6D#5O&|mq~K^OGhR?E*Y?*>}-XK>GeTOqV1wi OOhC-MUDSzX<~abXl_1do delta 102 zcmX@NP-NXg5yo|mjIE4}TN#-Gco^4h58`2(q|Yd|{i!w6B39uE3=9lR$@!&uB}J7C z%s`HF(DeKyCWGnn_Du5AIh>gIIHbX%+1b+%#xV&`Z-`}LYqxM>0%GRv7EUbF&H(_@ CJRCd# diff --git a/Source/Bogus/data/en.locale.json b/Source/Bogus/data/en.locale.json index 3f451623..0865b87b 100644 --- a/Source/Bogus/data/en.locale.json +++ b/Source/Bogus/data/en.locale.json @@ -9227,8 +9227,12 @@ }, { "country": "CR", - "total": 21, + "total": 22, "bban": [ + { + "type": "n", + "count": 1 + }, { "type": "n", "count": 3 @@ -9238,7 +9242,7 @@ "count": 14 } ], - "format": "CRkk bbbc cccc cccc cccc c" + "format": "CRkk xbbb cccc cccc cccc cc" }, { "country": "HR", diff --git a/Source/Bogus/data/en.locale.schema.verified.txt b/Source/Bogus/data/en.locale.schema.verified.txt index 82e866de..70681f76 100644 --- a/Source/Bogus/data/en.locale.schema.verified.txt +++ b/Source/Bogus/data/en.locale.schema.verified.txt @@ -1090,6 +1090,10 @@ }, { bban: [ + { + count: 1, + type: n + }, { count: 3, type: n @@ -1100,8 +1104,8 @@ } ], country: CR, - format: CRkk bbbc cccc cccc cccc c, - total: 21 + format: CRkk xbbb cccc cccc cccc cc, + total: 22 }, { bban: [ diff --git a/Source/Bogus/data_extend/en.locale.json b/Source/Bogus/data_extend/en.locale.json index 87f947f4..48d1e09b 100644 --- a/Source/Bogus/data_extend/en.locale.json +++ b/Source/Bogus/data_extend/en.locale.json @@ -470,8 +470,12 @@ }, { "country": "CR", - "total": 21, + "total": 22, "bban": [ + { + "type": "n", + "count": 1 + }, { "type": "n", "count": 3 @@ -481,7 +485,7 @@ "count": 14 } ], - "format": "CRkk bbbc cccc cccc cccc c" + "format": "CRkk xbbb cccc cccc cccc cc" }, { "country": "HR",