faker
faker copied to clipboard
refactor(locale): fix en_GB postcode patterns
Third and final part of #2390
- #2390
Related to #3235
- #3235
Blocked by #3223 and #3233
- #3223
- #3233
Fixes the pattern for en_GB using the patterns from the second page of this document (linked in the original issue)
Valid Formats
The following is a list of the valid formats of postcode. An ‘A’ indicates an alphabetic character, an ‘N’ indicates a numeric character.
Format Example
Outcode Incode Postcode AN NAA M1_1AA__ ANN NAA M60_1NW_ AAN NAA CR2_6XH_ AANN NAA DN55_1PT ANA NAA W1P_1HQ_ AANA NAA EC1A_1BB (Where _ represents a space)
The following characters are never used in the inward part of the postcode: C I K M O V
Workaround until this is merged:
const zipCode = faker.helpers.fake([
'{{helpers.fromRegExp("[A-Z]{1,2}[0-9]{1,2} [0-9][ABDEFGHJLNPQRSTUWXYZ]{2}")}}',
'{{helpers.fromRegExp("[A-Z]{1,2}[0-9][A-Z] [0-9][ABDEFGHJLNPQRSTUWXYZ]{2}")}}',
]);
(can also be used in browser console on our website)
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 99.96%. Comparing base (
b9930dc) to head (c0affe5).
Additional details and impacted files
@@ Coverage Diff @@
## refactor/location/zipCode/fake #3234 +/- ##
===============================================================
Coverage 99.96% 99.96%
===============================================================
Files 2805 2805
Lines 217143 217143
Branches 969 969
===============================================================
+ Hits 217066 217068 +2
+ Misses 77 75 -2
| Files with missing lines | Coverage Δ | |
|---|---|---|
| src/locales/en_GB/location/postcode_pattern.ts | 100.00% <100.00%> (ø) |