Add postal-code-formats to Test Data Management - #248
Open
vinceblock99 wants to merge 1 commit into
Open
vinceblock99 wants to merge 1 commit into
vinceblock99 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds postal-code-formats under Test Data Management.
What it is. An open (MIT) dataset of postal code formats, validation regexes and 9,000 real sample codes for 31 countries — as JSON, as CSV, as one plain-text sample file per country, and as a zero-dependency npm package.
Why it belongs on this list. Two things testers keep needing and usually hand-roll:
data/samples/<ISO2>.txtholds real codes, one per line. They are useful precisely because they are not uniform — Sweden's carry a space, Poland's a hyphen, Portugal's four digits then three, and the US file includes the leading-zero codes that break any form storing a postal code as an integer.libaddressinputmetadata, and nothing tells you when one has quietly gone wrong. Every pattern here is tested against every real sample code for its country in CI, so a pattern and the data cannot drift apart silently.It also records two things a plain format table leaves out, both of which are bugs in real address forms: which countries have no postal code at all (Hong Kong is present with
has_postal_code: false— a required postal field cannot be completed honestly there), and which sample codes are whole codes versus the published geographic half of one (Canada, the UK, Ireland and the Netherlands).validate()returnsundefinedrather thanfalsefor a country outside the dataset, so an uncovered country cannot silently reject a correct address.Disclosure: I maintain this package, and I am also the author of the FakeNamely entry already in this section. This is a separate artifact — a dataset and library rather than a hosted generator — and it stands on its own without that site.
data/ATTRIBUTION.md)