ngx-iban-validator 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,386 +0,0 @@
1
- import { validateIBAN } from "./iban.validator";
2
- describe("validateIBAN", () => {
3
- it("should return invalid result when country code is unsupported", () => {
4
- const control = { value: "ZZ11123456789012345678" };
5
- const result = validateIBAN(control);
6
- expect(result.ibanInvalid).toBe(true);
7
- expect(result.error).toEqual({
8
- countryUnsupported: true,
9
- codeLengthInvalid: false,
10
- patternInvalid: false,
11
- });
12
- });
13
- it("should return invalid result when IBAN length is incorrect", () => {
14
- const control = { value: "AT1112345678901234567" };
15
- const result = validateIBAN(control);
16
- expect(result.ibanInvalid).toBe(true);
17
- expect(result.error).toEqual({
18
- countryUnsupported: false,
19
- codeLengthInvalid: true,
20
- patternInvalid: false,
21
- });
22
- });
23
- it("should return invalid result when IBAN pattern is incorrect", () => {
24
- const control = { value: "AT48320000W0D234F864" };
25
- const result = validateIBAN(control);
26
- expect(result.ibanInvalid).toBe(true);
27
- expect(result.error).toEqual({
28
- countryUnsupported: false,
29
- codeLengthInvalid: false,
30
- patternInvalid: true,
31
- });
32
- });
33
- it("should return invalid result when country is supported but length is invalid", () => {
34
- const control = { value: "YE" };
35
- const result = validateIBAN(control);
36
- expect(result.ibanInvalid).toBe(true);
37
- expect(result.error).toEqual({
38
- countryUnsupported: false,
39
- codeLengthInvalid: true,
40
- patternInvalid: false,
41
- });
42
- });
43
- it("should return valid result when IBAN is valid", () => {
44
- const control = { value: "AT611904300234573201" };
45
- const result = validateIBAN(control);
46
- expect(result).toBe(null);
47
- });
48
- it("should return valid result when IBAN is passed as a string and not control value", () => {
49
- const value = "AT611904300234573201";
50
- const result = validateIBAN(value);
51
- expect(result.ibanInvalid).toBe(false);
52
- });
53
- it("validateIBAN for Albania AL35202111090000000001234567 should return null", () => {
54
- expect(validateIBAN({ value: "AL35202111090000000001234567" })).toBe(null);
55
- });
56
- it("validateIBAN for Algeria DZ580002100001113000000570 should return null", () => {
57
- expect(validateIBAN({ value: "DZ580002100001113000000570" })).toBe(null);
58
- });
59
- it("validateIBAN for Andorra AD1400080001001234567890 should return null", () => {
60
- expect(validateIBAN({ value: "AD1400080001001234567890" })).toBe(null);
61
- });
62
- it("validateIBAN for Angola AO06004400006729503010102 should return null", () => {
63
- expect(validateIBAN({ value: "AO06004400006729503010102" })).toBe(null);
64
- });
65
- it("validateIBAN for Austria AT483200000012345864 should return null", () => {
66
- expect(validateIBAN({ value: "AT483200000012345864" })).toBe(null);
67
- });
68
- it("validateIBAN for Azerbaijan AZ96AZEJ00000000001234567890 should return null", () => {
69
- expect(validateIBAN({ value: "AZ96AZEJ00000000001234567890" })).toBe(null);
70
- });
71
- it("validateIBAN for Bahrain BH02CITI00001077181611 should return null", () => {
72
- expect(validateIBAN({ value: "BH02CITI00001077181611" })).toBe(null);
73
- });
74
- it("validateIBAN for Belarus BY86AKBB10100000002966000000 should return null", () => {
75
- expect(validateIBAN({ value: "BY86AKBB10100000002966000000" })).toBe(null);
76
- });
77
- it("validateIBAN for Belgium BE71096123456769 should return null", () => {
78
- expect(validateIBAN({ value: "BE71096123456769" })).toBe(null);
79
- });
80
- it("validateIBAN for Benin BJ66BJ0610100100144390000769 should return null", () => {
81
- expect(validateIBAN({ value: "BJ66BJ0610100100144390000769" })).toBe(null);
82
- });
83
- it("validateIBAN for Bosnia and Herzegovina BA393385804800211234 should return null", () => {
84
- expect(validateIBAN({ value: "BA393385804800211234" })).toBe(null);
85
- });
86
- it("validateIBAN for Brazil BR1500000000000010932840814P2 should return null", () => {
87
- expect(validateIBAN({ value: "BR1500000000000010932840814P2" })).toBe(null);
88
- });
89
- it("validateIBAN for Bulgaria BG18RZBB91550123456789 should return null", () => {
90
- expect(validateIBAN({ value: "BG18RZBB91550123456789" })).toBe(null);
91
- });
92
- it("validateIBAN for Burundi BI1320001100010000123456789 should return null", () => {
93
- expect(validateIBAN({ value: "BI1320001100010000123456789" })).toBe(null);
94
- });
95
- it("validateIBAN for Burkina Faso BF42BF0840101300463574000390 should return null", () => {
96
- expect(validateIBAN({ value: "BF42BF0840101300463574000390" })).toBe(null);
97
- });
98
- it("validateIBAN for Cameroon CM2110002000300277976315008 should return null", () => {
99
- expect(validateIBAN({ value: "CM2110002000300277976315008" })).toBe(null);
100
- });
101
- it("validateIBAN for Cape Verde CV64000500000020108215144 should return null", () => {
102
- expect(validateIBAN({ value: "CV64000500000020108215144" })).toBe(null);
103
- });
104
- it("validateIBAN for Central African Republic CF4220001000010120069700160 should return null", () => {
105
- expect(validateIBAN({ value: "CF4220001000010120069700160" })).toBe(null);
106
- });
107
- it("validateIBAN for Chad TD8960002000010271091600153 should return null", () => {
108
- expect(validateIBAN({ value: "TD8960002000010271091600153" })).toBe(null);
109
- });
110
- it("validateIBAN for Comoros KM4600005000010010904400137 should return null", () => {
111
- expect(validateIBAN({ value: "KM4600005000010010904400137" })).toBe(null);
112
- });
113
- it("validateIBAN for Congo CG3930011000101013451300019 should return null", () => {
114
- expect(validateIBAN({ value: "CG3930011000101013451300019" })).toBe(null);
115
- });
116
- it("validateIBAN for Costa Rica CR23015108410026012345 should return null", () => {
117
- expect(validateIBAN({ value: "CR23015108410026012345" })).toBe(null);
118
- });
119
- it("validateIBAN for Croatia HR1723600001101234565 should return null", () => {
120
- expect(validateIBAN({ value: "HR1723600001101234565" })).toBe(null);
121
- });
122
- it("validateIBAN for Cyprus CY21002001950000357001234567 should return null", () => {
123
- expect(validateIBAN({ value: "CY21002001950000357001234567" })).toBe(null);
124
- });
125
- it("validateIBAN for Czech Republic CZ5508000000001234567899 should return null", () => {
126
- expect(validateIBAN({ value: "CZ5508000000001234567899" })).toBe(null);
127
- });
128
- it("validateIBAN for Denmark DK9520000123456789 should return null", () => {
129
- expect(validateIBAN({ value: "DK9520000123456789" })).toBe(null);
130
- });
131
- it("validateIBAN for Djibouti DJ2110002010010409943020008 should return null", () => {
132
- expect(validateIBAN({ value: "DJ2110002010010409943020008" })).toBe(null);
133
- });
134
- it("validateIBAN for Dominican Republic DO22ACAU00000000000123456789 should return null", () => {
135
- expect(validateIBAN({ value: "DO22ACAU00000000000123456789" })).toBe(null);
136
- });
137
- it("validateIBAN for Egypt EG800002000156789012345180002 should return null", () => {
138
- expect(validateIBAN({ value: "EG800002000156789012345180002" })).toBe(null);
139
- });
140
- it("validateIBAN for El Salvador SV43ACAT00000000000000123123 should return null", () => {
141
- expect(validateIBAN({ value: "SV43ACAT00000000000000123123" })).toBe(null);
142
- });
143
- it("validateIBAN for Equatorial Guinea GQ7050002001003715228190196 should return null", () => {
144
- expect(validateIBAN({ value: "GQ7050002001003715228190196" })).toBe(null);
145
- });
146
- it("validateIBAN for Estonia EE471000001020145685 should return null", () => {
147
- expect(validateIBAN({ value: "EE471000001020145685" })).toBe(null);
148
- });
149
- it("validateIBAN for Falkland Islands FK12SC987654321098 should return null", () => {
150
- expect(validateIBAN({ value: "FK12SC987654321098" })).toBe(null);
151
- });
152
- it("validateIBAN for Faroe Islands FO9264600123456789 should return null", () => {
153
- expect(validateIBAN({ value: "FO9264600123456789" })).toBe(null);
154
- });
155
- it("validateIBAN for Finland FI1410093000123458 should return null", () => {
156
- expect(validateIBAN({ value: "FI1410093000123458" })).toBe(null);
157
- });
158
- it("validateIBAN for France FR7630006000011234567890189 should return null", () => {
159
- expect(validateIBAN({ value: "FR7630006000011234567890189" })).toBe(null);
160
- });
161
- it("validateIBAN for Gabon GA2140021010032001890020126 should return null", () => {
162
- expect(validateIBAN({ value: "GA2140021010032001890020126" })).toBe(null);
163
- });
164
- it("validateIBAN for Georgia GE60NB0000000123456789 should return null", () => {
165
- expect(validateIBAN({ value: "GE60NB0000000123456789" })).toBe(null);
166
- });
167
- it("validateIBAN for Germany DE75512108001245126199 should return null", () => {
168
- expect(validateIBAN({ value: "DE75512108001245126199" })).toBe(null);
169
- });
170
- it("validateIBAN for Gibraltar GI04BARC000001234567890 should return null", () => {
171
- expect(validateIBAN({ value: "GI04BARC000001234567890" })).toBe(null);
172
- });
173
- it("validateIBAN for Greece GR9608100010000001234567890 should return null", () => {
174
- expect(validateIBAN({ value: "GR9608100010000001234567890" })).toBe(null);
175
- });
176
- it("validateIBAN for Greenland GL8964710123456789 should return null", () => {
177
- expect(validateIBAN({ value: "GL8964710123456789" })).toBe(null);
178
- });
179
- it("validateIBAN for Guatemala GT20AGRO00000000001234567890 should return null", () => {
180
- expect(validateIBAN({ value: "GT20AGRO00000000001234567890" })).toBe(null);
181
- });
182
- it("validateIBAN for Guinea-Bissau GW04GW1430010181800637601 should return null", () => {
183
- expect(validateIBAN({ value: "GW04GW1430010181800637601" })).toBe(null);
184
- });
185
- it("validateIBAN for Vatican VA59001123000012345678 should return null", () => {
186
- expect(validateIBAN({ value: "VA59001123000012345678" })).toBe(null);
187
- });
188
- it("validateIBAN for Honduras HN54PISA00000000000000123124 should return null", () => {
189
- expect(validateIBAN({ value: "HN54PISA00000000000000123124" })).toBe(null);
190
- });
191
- it("validateIBAN for Hungary HU93116000060000000012345676 should return null", () => {
192
- expect(validateIBAN({ value: "HU93116000060000000012345676" })).toBe(null);
193
- });
194
- it("validateIBAN for Iceland IS750001121234563108962099 should return null", () => {
195
- expect(validateIBAN({ value: "IS750001121234563108962099" })).toBe(null);
196
- });
197
- it("validateIBAN for Iran IR710570029971601460641001 should return null", () => {
198
- expect(validateIBAN({ value: "IR710570029971601460641001" })).toBe(null);
199
- });
200
- it("validateIBAN for Iraq IQ20CBIQ861800101010500 should return null", () => {
201
- expect(validateIBAN({ value: "IQ20CBIQ861800101010500" })).toBe(null);
202
- });
203
- it("validateIBAN for Ireland IE64IRCE92050112345678 should return null", () => {
204
- expect(validateIBAN({ value: "IE64IRCE92050112345678" })).toBe(null);
205
- });
206
- it("validateIBAN for Israel IL170108000000012612345 should return null", () => {
207
- expect(validateIBAN({ value: "IL170108000000012612345" })).toBe(null);
208
- });
209
- it("validateIBAN for Italy IT60X0542811101000000123456 should return null", () => {
210
- expect(validateIBAN({ value: "IT60X0542811101000000123456" })).toBe(null);
211
- });
212
- it("validateIBAN for Ivory Coast CI93CI0080111301134291200589 should return null", () => {
213
- expect(validateIBAN({ value: "CI93CI0080111301134291200589" })).toBe(null);
214
- });
215
- it("validateIBAN for Jordan JO71CBJO0000000000001234567890 should return null", () => {
216
- expect(validateIBAN({ value: "JO71CBJO0000000000001234567890" })).toBe(null);
217
- });
218
- it("validateIBAN for Kazakhstan KZ563190000012344567 should return null", () => {
219
- expect(validateIBAN({ value: "KZ563190000012344567" })).toBe(null);
220
- });
221
- it("validateIBAN for Kosovo XK051212012345678906 should return null", () => {
222
- expect(validateIBAN({ value: "XK051212012345678906" })).toBe(null);
223
- });
224
- it("validateIBAN for Kuwait KW81CBKU0000000000001234560101 should return null", () => {
225
- expect(validateIBAN({ value: "KW81CBKU0000000000001234560101" })).toBe(null);
226
- });
227
- it("validateIBAN for Latvia LV97HABA0012345678910 should return null", () => {
228
- expect(validateIBAN({ value: "LV97HABA0012345678910" })).toBe(null);
229
- });
230
- it("validateIBAN for Lebanon LB92000700000000123123456123 should return null", () => {
231
- expect(validateIBAN({ value: "LB92000700000000123123456123" })).toBe(null);
232
- });
233
- it("validateIBAN for Libya LY38021001000000123456789 should return null", () => {
234
- expect(validateIBAN({ value: "LY38021001000000123456789" })).toBe(null);
235
- });
236
- it("validateIBAN for Liechtenstein LI7408806123456789012 should return null", () => {
237
- expect(validateIBAN({ value: "LI7408806123456789012" })).toBe(null);
238
- });
239
- it("validateIBAN for Lithuania LT601010012345678901 should return null", () => {
240
- expect(validateIBAN({ value: "LT601010012345678901" })).toBe(null);
241
- });
242
- it("validateIBAN for Luxembourg LU120010001234567891 should return null", () => {
243
- expect(validateIBAN({ value: "LU120010001234567891" })).toBe(null);
244
- });
245
- it("validateIBAN for Madagascar MG4600005030071289421016045 should return null", () => {
246
- expect(validateIBAN({ value: "MG4600005030071289421016045" })).toBe(null);
247
- });
248
- it("validateIBAN for Mali ML13ML0160120102600100668497 should return null", () => {
249
- expect(validateIBAN({ value: "ML13ML0160120102600100668497" })).toBe(null);
250
- });
251
- it("validateIBAN for Malta MT31MALT01100000000000000000123 should return null", () => {
252
- expect(validateIBAN({ value: "MT31MALT01100000000000000000123" })).toBe(null);
253
- });
254
- it("validateIBAN for Mauritania MR1300020001010000123456753 should return null", () => {
255
- expect(validateIBAN({ value: "MR1300020001010000123456753" })).toBe(null);
256
- });
257
- it("validateIBAN for Mauritius MU43BOMM0101123456789101000MUR should return null", () => {
258
- expect(validateIBAN({ value: "MU43BOMM0101123456789101000MUR" })).toBe(null);
259
- });
260
- it("validateIBAN for Moldova MD21EX000000000001234567 should return null", () => {
261
- expect(validateIBAN({ value: "MD21EX000000000001234567" })).toBe(null);
262
- });
263
- it("validateIBAN for Monaco MC5810096180790123456789085 should return null", () => {
264
- expect(validateIBAN({ value: "MC5810096180790123456789085" })).toBe(null);
265
- });
266
- it("validateIBAN for Mongolia MN580050099123456789 should return null", () => {
267
- expect(validateIBAN({ value: "MN580050099123456789" })).toBe(null);
268
- });
269
- it("validateIBAN for Montenegro ME25505000012345678951 should return null", () => {
270
- expect(validateIBAN({ value: "ME25505000012345678951" })).toBe(null);
271
- });
272
- it("validateIBAN for Morocco MA64011519000001205000534921 should return null", () => {
273
- expect(validateIBAN({ value: "MA64011519000001205000534921" })).toBe(null);
274
- });
275
- it("validateIBAN for Mozambique MZ59000301080016367102371 should return null", () => {
276
- expect(validateIBAN({ value: "MZ59000301080016367102371" })).toBe(null);
277
- });
278
- it("validateIBAN for Netherlands NL02ABNA0123456789 should return null", () => {
279
- expect(validateIBAN({ value: "NL02ABNA0123456789" })).toBe(null);
280
- });
281
- it("validateIBAN for Nicaragua NI79BAMC00000000000003123123 should return null", () => {
282
- expect(validateIBAN({ value: "NI79BAMC00000000000003123123" })).toBe(null);
283
- });
284
- it("validateIBAN for Niger NE58NE0380100100130305000268 should return null", () => {
285
- expect(validateIBAN({ value: "NE58NE0380100100130305000268" })).toBe(null);
286
- });
287
- it("validateIBAN for North Macedonia MK07200002785123453 should return null", () => {
288
- expect(validateIBAN({ value: "MK07200002785123453" })).toBe(null);
289
- });
290
- it("validateIBAN for Norway NO8330001234567 should return null", () => {
291
- expect(validateIBAN({ value: "NO8330001234567" })).toBe(null);
292
- });
293
- it("validateIBAN for Pakistan PK36SCBL0000001123456702 should return null", () => {
294
- expect(validateIBAN({ value: "PK36SCBL0000001123456702" })).toBe(null);
295
- });
296
- it("validateIBAN for Palestine PS92PALS000000000400123456702 should return null", () => {
297
- expect(validateIBAN({ value: "PS92PALS000000000400123456702" })).toBe(null);
298
- });
299
- it("validateIBAN for Poland PL10105000997603123456789123 should return null", () => {
300
- expect(validateIBAN({ value: "PL10105000997603123456789123" })).toBe(null);
301
- });
302
- it("validateIBAN for Portugal PT50002700000001234567833 should return null", () => {
303
- expect(validateIBAN({ value: "PT50002700000001234567833" })).toBe(null);
304
- });
305
- it("validateIBAN for Qatar QA54QNBA000000000000693123456 should return null", () => {
306
- expect(validateIBAN({ value: "QA54QNBA000000000000693123456" })).toBe(null);
307
- });
308
- it("validateIBAN for Romania RO09BCYP0000001234567890 should return null", () => {
309
- expect(validateIBAN({ value: "RO09BCYP0000001234567890" })).toBe(null);
310
- });
311
- it("validateIBAN for Russia RU0204452560040702810412345678901 should return null", () => {
312
- expect(validateIBAN({ value: "RU0204452560040702810412345678901" })).toBe(null);
313
- });
314
- it("validateIBAN for Saint Lucia LC14BOSL123456789012345678901234 should return null", () => {
315
- expect(validateIBAN({ value: "LC14BOSL123456789012345678901234" })).toBe(null);
316
- });
317
- it("validateIBAN for San Marino SM76P0854009812123456789123 should return null", () => {
318
- expect(validateIBAN({ value: "SM76P0854009812123456789123" })).toBe(null);
319
- });
320
- it("validateIBAN for Sao Tome and Principe ST23000200000289355710148 should return null", () => {
321
- expect(validateIBAN({ value: "ST23000200000289355710148" })).toBe(null);
322
- });
323
- it("validateIBAN for Saudi Arabia SA4420000001234567891234 should return null", () => {
324
- expect(validateIBAN({ value: "SA4420000001234567891234" })).toBe(null);
325
- });
326
- it("validateIBAN for Senegal SN08SN0100152000048500003035 should return null", () => {
327
- expect(validateIBAN({ value: "SN08SN0100152000048500003035" })).toBe(null);
328
- });
329
- it("validateIBAN for Serbia RS35105008123123123173 should return null", () => {
330
- expect(validateIBAN({ value: "RS35105008123123123173" })).toBe(null);
331
- });
332
- it("validateIBAN for Seychelles SC52BAHL01031234567890123456USD should return null", () => {
333
- expect(validateIBAN({ value: "SC52BAHL01031234567890123456USD" })).toBe(null);
334
- });
335
- it("validateIBAN for Slovak Republic SK8975000000000012345671 should return null", () => {
336
- expect(validateIBAN({ value: "SK8975000000000012345671" })).toBe(null);
337
- });
338
- it("validateIBAN for Slovenia SI56192001234567892 should return null", () => {
339
- expect(validateIBAN({ value: "SI56192001234567892" })).toBe(null);
340
- });
341
- it("validateIBAN for Somalia ES7921000813610123456789 should return null", () => {
342
- expect(validateIBAN({ value: "SO061000001123123456789" })).toBe(null);
343
- });
344
- it("validateIBAN for Spain ES7921000813610123456789 should return null", () => {
345
- expect(validateIBAN({ value: "ES7921000813610123456789" })).toBe(null);
346
- });
347
- it("validateIBAN for Sudan SD8811123456789012 should return null", () => {
348
- expect(validateIBAN({ value: "SD8811123456789012" })).toBe(null);
349
- });
350
- it("validateIBAN for Sultanate of Oman OM040280000012345678901 should return null", () => {
351
- expect(validateIBAN({ value: "OM040280000012345678901" })).toBe(null);
352
- });
353
- it("validateIBAN for Sweden SE7280000810340009783242 should return null", () => {
354
- expect(validateIBAN({ value: "SE7280000810340009783242" })).toBe(null);
355
- });
356
- it("validateIBAN for Switzerland CH5604835012345678009 should return null", () => {
357
- expect(validateIBAN({ value: "CH5604835012345678009" })).toBe(null);
358
- });
359
- it("validateIBAN for Timor-Leste TL380010012345678910106 should return null", () => {
360
- expect(validateIBAN({ value: "TL380010012345678910106" })).toBe(null);
361
- });
362
- it("validateIBAN for Togo TG53TG0090604310346500400070 should return null", () => {
363
- expect(validateIBAN({ value: "TG53TG0090604310346500400070" })).toBe(null);
364
- });
365
- it("validateIBAN for Tunisia TN5904018104004942712345 should return null", () => {
366
- expect(validateIBAN({ value: "TN5904018104004942712345" })).toBe(null);
367
- });
368
- it("validateIBAN for Turkey TR320010009999901234567890 should return null", () => {
369
- expect(validateIBAN({ value: "TR320010009999901234567890" })).toBe(null);
370
- });
371
- it("validateIBAN for Ukraine UA903052992990004149123456789 should return null", () => {
372
- expect(validateIBAN({ value: "UA903052992990004149123456789" })).toBe(null);
373
- });
374
- it("validateIBAN for United Arab Emirates AE460090000000123456789 should return null", () => {
375
- expect(validateIBAN({ value: "AE460090000000123456789" })).toBe(null);
376
- });
377
- it("validateIBAN for United Kingdom GB33BUKB20201555555555 should return null", () => {
378
- expect(validateIBAN({ value: "GB33BUKB20201555555555" })).toBe(null);
379
- });
380
- it("validateIBAN for Virgin Islands, British VG21PACG0000000123456789 should return null", () => {
381
- expect(validateIBAN({ value: "VG21PACG0000000123456789" })).toBe(null);
382
- });
383
- it("validateIBAN for Yemen YE09CBKU0000000000001234560101 should return null", () => {
384
- expect(validateIBAN({ value: "YE09CBKU0000000000001234560101" })).toBe(null);
385
- });
386
- });
File without changes