Skip to content

The sdk/ TypeScript package has zero automated test coverage and is completely absent from CI #516

Description

@OxDev-max

Description

sdk/package.json declares "test": "jest", but:

  • jest does not appear anywhere in dependencies or devDependencies (only typescript and
    @types/node are listed) — running npm test in sdk/ fails immediately with a
    "command not found" / module-resolution error.
  • There are no *.test.ts/*.spec.ts files anywhere under sdk/.
  • .github/workflows/ci.yml contains exactly one job family (check, clippy, fmt,
    cycle-guard, test) and every one of them is Rust/cargo-only — there is no Node.js
    setup step, no npm install, no npm run build/npm test job anywhere in CI for sdk/.

The SDK (delivered under closed issue #207) is therefore entirely unverified by any automated
process: a change that breaks sdk/src/base.ts's XDR encoding, breaks the build, or introduces
a runtime bug would merge silently with a fully green CI run.

Requirements and Context

This is not "add more tests" filler — it's establishing test infrastructure that currently
does not exist at all for an entire deliverable package, and wiring it into CI so regressions
are caught automatically going forward, matching the rigor already applied to the Rust side.

Suggested Execution

  1. git checkout -b feature/sdk-test-infrastructure-ci
  2. Add jest, ts-jest, @types/jest to sdk/package.json's devDependencies; add a
    jest.config.js/ts-jest preset.
  3. Since BaseClient.invoke() talks to a real Soroban RPC endpoint, add a mocking layer (e.g.
    jest.mock around @stellar/stellar-sdk's rpc.Server) so unit tests can exercise
    KoraClient/each *Client class's argument-encoding and response-decoding logic without a
    live network — or, for deeper coverage, integrate a local Soroban sandbox / stellar-cli
    local network in CI and run true integration tests against deployed test contracts.
  4. Write unit tests for each of the 7 client classes covering at minimum: correct XDR argument
    construction for each method (matching the parameter counts fixed in issues Refactor Treasury Contracts #7/Optimize Financing Pool Contracts #9), and
    correct decoding of a mocked simulation/transaction response back into the documented TS types.
  5. Add a sdk job to .github/workflows/ci.yml that runs npm ci, npm run build (tsc),
    and npm test inside sdk/, gating merges the same way the Rust jobs do.
  6. Run everything locally and in CI to confirm green.

Acceptance Criteria

  • npm test inside sdk/ runs and passes without manual setup beyond npm install
  • Each of the 7 SDK client classes has at least one passing test exercising argument encoding and response decoding
  • .github/workflows/ci.yml contains a job that builds and tests sdk/ on every PR
  • A deliberately broken SDK change (e.g. wrong arg order) is demonstrated to fail the new CI job in the PR description or a linked draft commit

Guidelines: PR description must include Closes #<issue-number>.
Complexity: High (200 points)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions