UK postcode formats: spacing, units and test cases
Keep the outward and inward code together with its locality when testing UK address forms.
AI summary
The final three characters form the inward code; the preceding part is the outward code. Keep the separating space in display and retain the original input separately from a normalized value.
Two parts, one text value
The final three characters form the inward code; the preceding part is the outward code. Keep the separating space in display and retain the original input separately from a normalized value. A pattern match says nothing about whether the postcode is currently assigned.
Exercise the form and the export
Test lowercase input, additional spaces, a missing postcode and a long building name. Avoid a numeric input type. In fakeloc, choose United Kingdom, save a seed and export JSON so a regression report can reproduce the same city/postcode choice within the same data version.
Lookup is a separate step
A map may return a nearby location when the synthetic street is not found. For delivery, use an authorized postcode/address lookup rather than treating the map pin as validation. Our sampled GeoNames rows retain city/postcode associations, while the street is generated independently.