File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,21 @@ class PhoneNumber {
121
121
'+81 0###-###-####' ,
122
122
'+81 (0###) ###-####' ,
123
123
];
124
+ static const krPhoneNumberPatterns = [
125
+ // Standard 10-digit phone number formats
126
+ '010########' ,
127
+ '010-####-####' ,
128
+ '010.####.####' ,
129
+ // Standard 11-digit phone number formats
130
+ '01#########' ,
131
+ '01#-###-####' ,
132
+ '01#.###.####' ,
133
+ // Standard 11-digit phone number formats with country code
134
+ '+82-10-####-####' ,
135
+ '+82 10 #### ####' ,
136
+ '+82-1#-###-####' ,
137
+ '+82 1# ### ####' ,
138
+ ];
124
139
125
140
const PhoneNumber (this .random);
126
141
@@ -131,4 +146,6 @@ class PhoneNumber {
131
146
String de () => random.fromPattern (dePhoneNumberPatterns);
132
147
133
148
String ja () => random.fromPattern (jaPhoneNumberPatterns);
149
+
150
+ String kr () => random.fromPattern (krPhoneNumberPatterns);
134
151
}
Original file line number Diff line number Diff line change @@ -181,4 +181,30 @@ void main() {
181
181
}
182
182
});
183
183
});
184
+ group ('kr' , () {
185
+ test ('should be able to generate kr phone number' , () {
186
+ for (var i = 0 ; i < 20 ; i++ ) {
187
+ expect (
188
+ faker.phoneNumber.kr (),
189
+ anyOf ([
190
+ // Standard 10-digit phone number formats
191
+ matches (r'010\d{8}' ),
192
+ matches (r'010-\d{4}-\d{4}' ),
193
+ matches (r'010\.\d{4}\.\d{4}' ),
194
+
195
+ // Standard 11-digit phone number formats
196
+ matches (r'01\d{9}' ),
197
+ matches (r'01\d-\d{3}-\d{4}' ),
198
+ matches (r'01\d\.\d{3}\.\d{4}' ),
199
+
200
+ // Standard 11-digit phone number formats with country code
201
+ matches (r'\+82-10-\d{4}-\d{4}' ),
202
+ matches (r'\+82 10 \d{4} \d{4}' ),
203
+ matches (r'\+82-1\d-\d{3}-\d{4}' ),
204
+ matches (r'\+82 1\d \d{3} \d{4}' ),
205
+ ]),
206
+ );
207
+ }
208
+ });
209
+ });
184
210
}
You can’t perform that action at this time.
0 commit comments