test: add validators module and comprehensive test harness#25
Open
jesustorres-code wants to merge 1 commit into
Open
test: add validators module and comprehensive test harness#25jesustorres-code wants to merge 1 commit into
jesustorres-code wants to merge 1 commit into
Conversation
Extracts all argument-validation logic from index.ts into a dedicated src/validators.ts module (parseGitHubRepo, requireNonEmpty, toolError) and replaces 9 inline validation blocks across 8 tool handlers with calls to those helpers. Adds test/validators.test.mjs (node:test, no extra dependencies) with 19 cases covering parseGitHubRepo (8 happy paths including query-string and fragment stripping, 5 error paths) and requireNonEmpty (6 cases across all field-name permutations used in the handlers). Wires npm test into ci.yml so the suite gates every PR. Closes eliottreich#16 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Owner
|
Thanks for this, genuinely useful work. We've put a funded $10 TaskBounty bounty on the underlying issue: https://www.task-bounty.com/task/taskbounty-mcp-server-16-add-a-test-harness-and-ru-q8mnpc . To claim it, register at https://www.task-bounty.com/, then submit your fix through the platform (REST API, MCP server, or the patch-upload endpoint). It runs against the repo's own tests in an isolated sandbox, and on a verified pass you're paid through escrow in USDC, ETH, BTC, or bank. We keep payment on-platform so it stays verified and auditable for everyone. First verified submission wins it. |
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
index.tsintosrc/validators.ts(parseGitHubRepo,requireNonEmpty,toolError) — replaces 9 inline validation blocks across 8 tool handlerstest/validators.test.mjsusing Node's built-innode:test(zero new dependencies) with 19 test casesnpm testintoci.ymlso the suite gates every PRTest coverage
parseGitHubRepo(13 cases):owner/name— plain shorthandhttps://andhttp://full GitHub URLs.gitsuffix stripping.git+ trailing slash?tab=issues)#readme).gitnull/undefined→ "repo is required"requireNonEmpty(6 cases):null(no error)null,undefined→isError: trueWhy this is more complete than PR #24
PR #24 extracts only
parseGitHubRepoand applies it to one handler. This PR:requireNonEmpty) used across 8 handlersindex.ts(not just one case), eliminating the duplicationCloses #16