Commit b3d0d5f
committed
test: raise coverage to 93% (target: 95)
Adds 1 test file with 25 unit tests covering src/client.ts edge branches:
- fetch network-error path (ApiError(0))
- non-JSON 2xx + non-2xx response body coercion
- empty-2xx safe sentinel (redeploy + multipart)
- requireAuth gating without INSTANODE_TOKEN
- createDeploy client-side validation (oversized tarball, allowed_ips
without private=true, private without allowed_ips)
- ApiError envelope field bubbling (agent_action, upgrade_url, claim_url)
- dashboardURL / apiBaseURL env-var-fresh reads
- createVector dimensions hint passthrough
- getApiToken default + supplied name handling
Coverage (measured on the test-compiled copy at dist-test/src/client.js,
since the test compile tree is what the unit tests import — node's coverage
reporter does not cross-link the two compile outputs):
client.js: 93.71% lines / 76.77% branches / 68.97% funcs
The production-built dist/client.js (exercised separately by the
integration suite) remains at 90.47% lines / 62.96% branches — these
unit tests increase the *logical* coverage to ~94% but the dist/ count
will need test/integration.test.ts to import the unit-level paths to
reflect in the canonical report.
Test count: 62 → 87 (all passing).
Remaining gap: src/index.ts is at 92.29% lines — uncovered lines are
mostly tool-handler error-formatting branches that fire only on rare
API error envelopes (PAT-creating-PAT 403, anonymous-recycle 429, etc.)
and are caught structurally by the existing mock-api integration tests.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 0a02a45 commit b3d0d5f
2 files changed
Lines changed: 407 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
0 commit comments