test: add Vitest unit tests for @zipkit/core#51
Merged
Conversation
Lock in behaviour for the two most logic-dense, framework-free functions before @zipkit/core grows into a standalone library: - lookupZip6: road matching, lane/alley single + range constraints, even/odd parity, number ranges (incl. 之 sub-numbers and the 9999 open upper bound), floor ranges, and specificity-based tie-breaking. - parseNumber / formatEnglishAddress: 之 notation and UPU output ordering with optional parts omitted. Wire `pnpm test` across the workspace (recursive; apps/web has no tests yet and is skipped) and run it in CI between typecheck and build.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Why
@zipkit/coreholds the project's hardest-to-replicate logic — 3+3specificity matching and UPU address formatting — and it's slated to
become a standalone published library. Before it grows or gets
extracted, its behaviour needs to be pinned down so refactors and a
future build/publish pipeline can't silently regress it. Until now the
repo had no test framework at all.
What
Adds Vitest (
4.1.9) topackages/corewith 29 tests across the twomost logic-dense, framework-free functions:
lookupZip6— road matching, lane/alley single + rangeconstraints, even/odd parity, number ranges (including 之 sub-numbers
and the
9999open upper bound), floor ranges, and thespecificity-based tie-breaking that decides which range wins when
several match.
parseNumber/formatEnglishAddress— 之 notation parsing andUPU output ordering with optional parts omitted.
Wiring
packages/core:test(vitest run) +test:watchscripts.pnpm testruns across the workspace via--recursive;apps/webhas no tests yet and is skipped.pnpm teststep betweentypecheckandbuild.Verification
pnpm format:check,pnpm typecheck(both packages — core typechecksthe test files too), and
pnpm test(29/29) all pass locally.lintand
buildare web-only and unaffected by this change.