File tree 3 files changed +20
-1
lines changed
src/locales/zh_CN/finance/credit_card
3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 4
4
*/
5
5
import type { FinanceDefinition } from '../../../..' ;
6
6
import mastercard from './mastercard' ;
7
+ import unionpay from './unionpay' ;
7
8
import visa from './visa' ;
8
9
9
10
const credit_card : FinanceDefinition [ 'credit_card' ] = {
10
11
mastercard,
12
+ unionpay,
11
13
visa,
12
14
} ;
13
15
Original file line number Diff line number Diff line change
1
+ export default [
2
+ '62#############L' ,
3
+ '67#############L' ,
4
+ '81#############L' ,
5
+ '81##############L' ,
6
+ '81###############L' ,
7
+ '81################L' ,
8
+ ] ;
Original file line number Diff line number Diff line change 1
1
import isValidBtcAddress from 'validator/lib/isBtcAddress' ;
2
+ import isCreditCard from 'validator/lib/isCreditCard' ;
2
3
import { describe , expect , it } from 'vitest' ;
3
- import { faker } from '../../src' ;
4
+ import { faker , fakerZH_CN } from '../../src' ;
4
5
import { FakerError } from '../../src/errors/faker-error' ;
5
6
import ibanLib from '../../src/modules/finance/iban' ;
6
7
import { luhnCheck } from '../../src/modules/helpers/luhn-check' ;
@@ -476,6 +477,14 @@ describe('finance', () => {
476
477
expect ( maestro ) . toSatisfy ( luhnCheck ) ;
477
478
} ) ;
478
479
480
+ it ( 'should generate a valid union pay credit card' , ( ) => {
481
+ const actual = fakerZH_CN . finance . creditCardNumber ( 'unionpay' ) ;
482
+ expect ( actual ) . toSatisfy ( luhnCheck ) ;
483
+ expect ( actual ) . toSatisfy ( ( value ) =>
484
+ isCreditCard ( value as string , { provider : 'unionpay' } )
485
+ ) ;
486
+ } ) ;
487
+
479
488
it ( 'should return custom formatted strings' , ( ) => {
480
489
let number = faker . finance . creditCardNumber ( '###-###-##L' ) ;
481
490
expect ( number ) . toMatch ( / ^ \d { 3 } \- \d { 3 } \- \d { 3 } $ / ) ;
You can’t perform that action at this time.
0 commit comments