Skip to content

Commit b3d0d5f

Browse files
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

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"dev": "tsc --watch",
4747
"start": "node dist/index.js",
4848
"pretest": "tsc && tsc -p tsconfig.test.json",
49-
"test": "node --test dist-test/test/integration.test.js dist-test/test/live-smoke.test.js",
49+
"test": "node --test dist-test/test/integration.test.js dist-test/test/live-smoke.test.js dist-test/test/client-unit.test.js",
5050
"test:smoke": "bash test.sh",
5151
"prepublishOnly": "npm run build"
5252
},

0 commit comments

Comments
 (0)