diff options
| author | Matt Mayer <[email protected]> | 2023-09-30 03:13:47 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-09-29 22:13:47 +0200 |
| commit | dd21c0fb1555590d4d552317356c57772be82c50 (patch) | |
| tree | 546fd88775c138302cd7fd4606f2e94f24ca617d /test/modules | |
| parent | c498c091f488db287684690ab4ff109b1589523f (diff) | |
| download | faker-dd21c0fb1555590d4d552317356c57772be82c50.tar.xz faker-dd21c0fb1555590d4d552317356c57772be82c50.zip | |
chore(finance): update mastercard patterns and test (#2396)
Diffstat (limited to 'test/modules')
| -rw-r--r-- | test/modules/__snapshots__/finance.spec.ts.snap | 12 | ||||
| -rw-r--r-- | test/modules/finance.spec.ts | 7 |
2 files changed, 14 insertions, 5 deletions
diff --git a/test/modules/__snapshots__/finance.spec.ts.snap b/test/modules/__snapshots__/finance.spec.ts.snap index 6f80a2ed..b80380b9 100644 --- a/test/modules/__snapshots__/finance.spec.ts.snap +++ b/test/modules/__snapshots__/finance.spec.ts.snap @@ -46,7 +46,9 @@ exports[`finance > 42 > creditCardNumber > noArgs 1`] = `"6591-6277-5514-1004-83 exports[`finance > 42 > creditCardNumber > with issuer 1`] = `"4791775514102"`; -exports[`finance > 42 > creditCardNumber > with issuer option 1`] = `"4791775514102"`; +exports[`finance > 42 > creditCardNumber > with issuer option mastercard 1`] = `"5491-7755-1410-0488"`; + +exports[`finance > 42 > creditCardNumber > with issuer option visa 1`] = `"4791775514102"`; exports[`finance > 42 > currency 1`] = ` { @@ -154,7 +156,9 @@ exports[`finance > 1211 > creditCardNumber > noArgs 1`] = `"4872190616274"`; exports[`finance > 1211 > creditCardNumber > with issuer 1`] = `"4487-2190-6162-7436"`; -exports[`finance > 1211 > creditCardNumber > with issuer option 1`] = `"4487-2190-6162-7436"`; +exports[`finance > 1211 > creditCardNumber > with issuer option mastercard 1`] = `"2450-8721-9061-6279"`; + +exports[`finance > 1211 > creditCardNumber > with issuer option visa 1`] = `"4487-2190-6162-7436"`; exports[`finance > 1211 > currency 1`] = ` { @@ -262,7 +266,9 @@ exports[`finance > 1337 > creditCardNumber > noArgs 1`] = `"3612-254032-5529"`; exports[`finance > 1337 > creditCardNumber > with issuer 1`] = `"4512254032550"`; -exports[`finance > 1337 > creditCardNumber > with issuer option 1`] = `"4512254032550"`; +exports[`finance > 1337 > creditCardNumber > with issuer option mastercard 1`] = `"5312-2540-3255-2395"`; + +exports[`finance > 1337 > creditCardNumber > with issuer option visa 1`] = `"4512254032550"`; exports[`finance > 1337 > currency 1`] = ` { diff --git a/test/modules/finance.spec.ts b/test/modules/finance.spec.ts index d5de1817..97bcdcc7 100644 --- a/test/modules/finance.spec.ts +++ b/test/modules/finance.spec.ts @@ -92,7 +92,8 @@ describe('finance', () => { t.describe('creditCardNumber', (t) => { t.it('noArgs') .it('with issuer', 'visa') - .it('with issuer option', { issuer: 'visa' }); + .it('with issuer option visa', { issuer: 'visa' }) + .it('with issuer option mastercard', { issuer: 'mastercard' }); }); t.describe('mask', (t) => { @@ -459,7 +460,9 @@ describe('finance', () => { expect(visa).toSatisfy(luhnCheck); const mastercard = faker.finance.creditCardNumber('mastercard'); - expect(mastercard).toMatch(/^(5[1-5]\d{2}|6771)(\-\d{4}){3}$/); + expect(mastercard).toSatisfy((value) => + isCreditCard(value as string, { provider: 'mastercard' }) + ); expect(mastercard).toSatisfy(luhnCheck); const discover = faker.finance.creditCardNumber('discover'); |
