test: add Vitest setup with SiteManager and tool-registry coverage#18
Open
kleintech wants to merge 1 commit into
Open
test: add Vitest setup with SiteManager and tool-registry coverage#18kleintech wants to merge 1 commit into
kleintech wants to merge 1 commit into
Conversation
Establishes a foundation test suite using Vitest. ESM/TypeScript tests run via esbuild without needing a prior tsc build. - SiteManager: env parsing (numbered + legacy), getSite lookup, and detectSiteFromContext (domain/alias/id matching). 17 tests. - Tool registry wiring: every tool has a handler, names are unique, schemas are object-shaped with properties. 7 tests. - GitHub Actions workflow runs npm test on PRs and pushes to main across Node 20 and 22. - README documents the new test commands. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
Establishes a foundation test suite using Vitest. ESM/TypeScript tests run via esbuild — no prior
tscbuild needed.SiteManager(17 tests) — env parsing (numberedWORDPRESS_N_*and legacyWORDPRESS_API_URL),getSitelookup with error paths, anddetectSiteFromContextcovering domain/alias/id matching, case-insensitivity, and null cases.inputSchemawith apropertiesrecord. Catches regressions when adding or renaming tools..github/workflows/test.yml) — runsnpm teston PRs and pushes tomainon a Node 20 / 22 matrix.npm testruns the full suite in ~500ms.Notes
npm install --ignore-scriptsbecause thepreparehook runsnpm run build, which currently fails on a fresh install due to axios type drift inmedia.tsand aTS2589inserver.ts. Those are pre-existing and unrelated to this PR — happy to fix them in a separate one.Test plan
npm testpasses locally (24/24)npm run test:watchre-runs on file changes🤖 Generated with Claude Code