diff --git a/src/modules/finance/index.ts b/src/modules/finance/index.ts index d1580603e24..c73bf6aec4b 100644 --- a/src/modules/finance/index.ts +++ b/src/modules/finance/index.ts @@ -231,7 +231,7 @@ export class FinanceModule { * @since 3.1.0 */ bitcoinAddress(): string { - const addressLength = this.faker.datatype.number({ min: 25, max: 34 }); + const addressLength = this.faker.datatype.number({ min: 25, max: 39 }); let address = this.faker.helpers.arrayElement(['1', '3']); diff --git a/test/__snapshots__/finance.spec.ts.snap b/test/__snapshots__/finance.spec.ts.snap index 1cc36e29923..e42b6c80d26 100644 --- a/test/__snapshots__/finance.spec.ts.snap +++ b/test/__snapshots__/finance.spec.ts.snap @@ -18,7 +18,7 @@ exports[`finance > 42 > amount > with min and max and dec and symbol 1`] = `"$24 exports[`finance > 42 > bic 1`] = `"JUYEPSSLXXX"`; -exports[`finance > 42 > bitcoinAddress 1`] = `"3XbJMAAara64sSkA9HD24YHQWd1b"`; +exports[`finance > 42 > bitcoinAddress 1`] = `"3XbJMAAara64sSkA9HD24YHQWd1bZb"`; exports[`finance > 42 > creditCardCVV 1`] = `"379"`; @@ -82,7 +82,7 @@ exports[`finance > 1211 > amount > with min and max and dec and symbol 1`] = `"$ exports[`finance > 1211 > bic 1`] = `"YLXUDE4Z"`; -exports[`finance > 1211 > bitcoinAddress 1`] = `"1TMe8Z3EaFdLqmaGKP1LEEJQVriSZRZdsA"`; +exports[`finance > 1211 > bitcoinAddress 1`] = `"1TMe8Z3EaFdLqmaGKP1LEEJQVriSZRZdsAUc9n"`; exports[`finance > 1211 > creditCardCVV 1`] = `"948"`; @@ -146,7 +146,7 @@ exports[`finance > 1337 > amount > with min and max and dec and symbol 1`] = `"$ exports[`finance > 1337 > bic 1`] = `"GOEFFIJG"`; -exports[`finance > 1337 > bitcoinAddress 1`] = `"3adhxs2jewAgkYgJi7No6Cn8JZa"`; +exports[`finance > 1337 > bitcoinAddress 1`] = `"3adhxs2jewAgkYgJi7No6Cn8JZar"`; exports[`finance > 1337 > creditCardCVV 1`] = `"251"`; diff --git a/test/finance.spec.ts b/test/finance.spec.ts index afc671a7628..70534449efd 100644 --- a/test/finance.spec.ts +++ b/test/finance.spec.ts @@ -1,3 +1,4 @@ +import isValidBtcAddress from 'validator/lib/isBtcAddress'; import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; import { FakerError } from '../src/errors/faker-error'; @@ -290,7 +291,7 @@ describe('finance', () => { expect(bitcoinAddress).toBeTruthy(); expect(bitcoinAddress).toBeTypeOf('string'); - expect(bitcoinAddress).toMatch(/^[13][a-km-zA-HJ-NP-Z1-9]{24,33}$/); + expect(bitcoinAddress).toSatisfy(isValidBtcAddress); }); });