Skip to content

test: add Vitest unit tests for @zipkit/core#51

Merged
ronload merged 1 commit into
mainfrom
test/core-vitest
Jun 24, 2026
Merged

test: add Vitest unit tests for @zipkit/core#51
ronload merged 1 commit into
mainfrom
test/core-vitest

Conversation

@ronload

@ronload ronload commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Why

@zipkit/core holds the project's hardest-to-replicate logic — 3+3
specificity 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) to packages/core with 29 tests across the two
most logic-dense, framework-free functions:

  • lookupZip6 — road matching, lane/alley single + range
    constraints, even/odd parity, number ranges (including 之 sub-numbers
    and the 9999 open upper bound), floor ranges, and the
    specificity-based tie-breaking that decides which range wins when
    several match.
  • parseNumber / formatEnglishAddress — 之 notation parsing and
    UPU output ordering with optional parts omitted.

Wiring

  • packages/core: test (vitest run) + test:watch scripts.
  • Root: pnpm test runs across the workspace via --recursive;
    apps/web has no tests yet and is skipped.
  • CI: a pnpm test step between typecheck and build.

Verification

pnpm format:check, pnpm typecheck (both packages — core typechecks
the test files too), and pnpm test (29/29) all pass locally. lint
and build are web-only and unaffected by this change.

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.
@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zipkit Ready Ready Preview, Comment Jun 24, 2026 5:10am

@ronload ronload merged commit 6661721 into main Jun 24, 2026
4 checks passed
@ronload ronload deleted the test/core-vitest branch June 24, 2026 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant