Skip to content

Increase SDK CraftClient test coverage to all public methods #499

@temma02

Description

@temma02

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

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions