Description
packages/sdk/tests/client.test.ts covers the core auth and template methods but getDeploymentHealth, getDeploymentAnalytics, cancelSubscription, and getSubscription have no tests. SDK consumers rely on these methods being correct.
Requirements and context
- Must be secure, tested, and documented where applicable
- Should stay reviewable and fit the current monorepo structure
- Relevant files:
packages/sdk/src/client.ts, packages/sdk/tests/client.test.ts
Suggested execution
- Create branch:
issue-025-sdk-client-full-method-coverage
- Keep changes scoped to the issue and reference the task IDs in the PR
Implement changes
- Add tests for
getDeploymentHealth, getDeploymentAnalytics, cancelSubscription, getSubscription
- Use the existing
mockFetch helper to simulate success and error responses
- Assert that
CraftApiError is thrown with the correct status code on non-2xx responses
Test and commit
- Run
vitest run packages/sdk and confirm 100% method coverage
- Include request/response examples for each new test case
- Edge case:
setAccessToken not called before a protected method — should throw CraftApiError with 401
Example commit message
test(sdk): add full coverage for all CraftClient public methods
Guidelines
- Prefer small, reviewable PRs
- Keep naming and data contracts consistent with the spec docs
Description
packages/sdk/tests/client.test.tscovers the core auth and template methods butgetDeploymentHealth,getDeploymentAnalytics,cancelSubscription, andgetSubscriptionhave no tests. SDK consumers rely on these methods being correct.Requirements and context
packages/sdk/src/client.ts,packages/sdk/tests/client.test.tsSuggested execution
issue-025-sdk-client-full-method-coverageImplement changes
getDeploymentHealth,getDeploymentAnalytics,cancelSubscription,getSubscriptionmockFetchhelper to simulate success and error responsesCraftApiErroris thrown with the correct status code on non-2xx responsesTest and commit
vitest run packages/sdkand confirm 100% method coveragesetAccessTokennot called before a protected method — should throwCraftApiErrorwith 401Example commit message
Guidelines