Skip to content

Commit 57f481c

Browse files
authored
Merge branch 'main' into docs/complex-defaults
2 parents 9426b38 + 3f3de78 commit 57f481c

File tree

3 files changed

+73
-14
lines changed

3 files changed

+73
-14
lines changed

docs/.vitepress/config.mjs

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,10 @@ const sidebar = {
4040
],
4141
};
4242

43-
// grab from process.env once this is building on netlify
4443
const algolia = {
45-
apiKey: '',
46-
indexName: '',
47-
searchParameters: {
48-
facetFilters: [''],
49-
},
44+
apiKey: process.env.API_KEY,
45+
appId: process.env.APP_ID,
46+
indexName: 'fakerjs',
5047
};
5148

5249
const description =
@@ -62,27 +59,42 @@ export default defineConfig({
6259
[
6360
'meta',
6461
{
65-
property: 'og:description',
62+
name: 'og:description',
6663
content: description,
6764
},
65+
],
66+
[
67+
'meta',
6868
{
6969
name: 'twitter:description',
7070
content: description,
7171
},
72+
],
73+
[
74+
'meta',
7275
{
7376
name: 'description',
7477
content: description,
7578
},
79+
],
80+
[
81+
'meta',
7682
{
77-
property: 'og:image',
83+
name: 'og:image',
7884
content: image,
7985
},
86+
],
87+
[
88+
'meta',
8089
{
81-
property: 'twitter:image',
90+
name: 'twitter:image',
8291
content: image,
8392
},
93+
],
94+
[
95+
'meta',
8496
{
85-
property: 'twitter:card',
97+
name: 'twitter:card',
8698
content: 'summary_large_image',
8799
},
88100
],
@@ -96,7 +108,6 @@ export default defineConfig({
96108
editLinkText: 'Suggest changes to this page',
97109
nav,
98110
sidebar,
99-
// TODO 2022-03-06: https://github.com/faker-js/faker/issues/222
100-
// algolia,
111+
algolia,
101112
},
102113
});

src/iban.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,12 @@ export = {
206206
},
207207
{
208208
country: 'CR',
209-
total: 21,
209+
total: 22,
210210
bban: [
211+
{
212+
type: 'n',
213+
count: 1,
214+
},
211215
{
212216
type: 'n',
213217
count: 3,
@@ -217,7 +221,7 @@ export = {
217221
count: 14,
218222
},
219223
],
220-
format: 'CRkk bbbc cccc cccc cccc c',
224+
format: 'CRkk xbbb cccc cccc cccc cc',
221225
},
222226
{
223227
country: 'HR',

test/finance_iban.spec.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,50 @@ describe('finance_iban', () => {
255255
'the result should be equal to 1'
256256
).toBe(1);
257257
});
258+
259+
it('IBAN for Costa Rica is correct', () => {
260+
// Costa Rica
261+
// https://wise.com/us/iban/costa-rica
262+
// Length 22
263+
// BBAN 1n,3n,14n
264+
// CRkk xbbb cccc cccc cccc cccc cccc
265+
// x = reserve digit
266+
// b = National bank code (digits)
267+
// c = Account number (digits)
268+
269+
// example IBAN CR05 0152 0200 1026 2840 66
270+
271+
const iban = faker.finance.iban(false, 'CR');
272+
273+
expect(iban).satisfy(validator.isIBAN);
274+
275+
const ibanFormated = iban.match(/.{1,4}/g).join(' ');
276+
const bban = iban.substring(4) + iban.substring(0, 4);
277+
278+
expect(
279+
22,
280+
`CR IBAN would be 22 chars length, given is ${iban.length}`
281+
).toBe(iban.length);
282+
283+
expect(
284+
iban.substring(0, 2),
285+
iban.substring(0, 2) +
286+
"must start with 'CR' in CR IBAN " +
287+
ibanFormated
288+
).to.eq('CR');
289+
290+
expect(
291+
iban.substring(2, 22),
292+
iban.substring(2, 22) +
293+
' must contains only digit in AZ IBAN ' +
294+
ibanFormated
295+
).match(/^\d{20}$/);
296+
297+
expect(
298+
ibanLib.mod97(ibanLib.toDigitString(bban)),
299+
'the result should be equal to 1'
300+
).toBe(1);
301+
});
258302
});
259303
}
260304
});

0 commit comments

Comments
 (0)