Skip to content

Add unit tests for Go, Python, and JS/TS REST clients - #15

Merged
Nic-dorman merged 6 commits into
fix/code-review-findingsfrom
feat/sdk-test-coverage
Apr 1, 2026
Merged

Add unit tests for Go, Python, and JS/TS REST clients#15
Nic-dorman merged 6 commits into
fix/code-review-findingsfrom
feat/sdk-test-coverage

Conversation

@Nic-dorman

Copy link
Copy Markdown
Collaborator

Summary

  • Go (+147 lines): 6 new tests for wallet/external signer methods that previously had zero coverage
  • Python (+229 lines): 14 tests with threaded mock HTTP server covering all REST endpoints + error mapping
  • JS/TS (+511 lines): 31 vitest tests with mocked fetch covering all endpoints, 7 error codes, network errors, and timeouts

All tests verified passing locally.

Test plan

  • go test ./... — 13/13 pass
  • pytest tests/test_rest_client.py — 14/14 pass
  • npx vitest run — 31/31 pass

🤖 Generated with Claude Code

Nic-dorman and others added 6 commits April 1, 2026 18:31
- antd-go: add 6 tests for wallet and external signer methods
  (WalletAddress, WalletBalance, WalletApprove, PrepareUpload,
  PrepareDataUpload, FinalizeUpload) using httptest mock daemon
- antd-py: add 14 tests for REST client using threaded mock HTTP
  server — covers health, data, chunks, wallet, and error mapping
  (404→NotFoundError, 400→BadRequestError, 502→NetworkError)
- antd-js: add 31 vitest tests for REST client with mocked fetch —
  covers all endpoints, error status mapping (7 codes), network
  errors, timeout handling, and constructor options

All tests verified passing: Go 13/13, Python 14/14, JS 31/31.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- antd-rust: remove graph.proto from build.rs, delete dead 05-graph
  example, remove Cargo.toml example entry, update tests and examples
  to pass payment_mode parameter (added in prior commit), fix doctest
- antd-csharp: remove graph.proto from csproj, add wallet and external
  signer stubs to gRPC client (NotSupportedException)

All test suites now pass:
  Go: 35 pass | Python: 43 pass | JS: 31 pass | Rust: 55 pass
  PHP: 23 pass | Dart: 43 pass | C#: builds clean (integration tests)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- antd-zig: remove parseGraphEntry, GraphDescendant from json_helpers
  and 3 graph-related tests from tests.zig
- antd-csharp: already fixed graph.proto in csproj (prior commit)
- antd-kotlin: proto files copied by gradle copyProtos task (no graph)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- lib/build.gradle.kts: add afterEvaluate block to ensure generateProto
  depends on copyProtos (was running before proto files were copied)
- lib/build.gradle.kts: add junit-platform-launcher to test runtime
  (was failing with "Failed to load JUnit Platform")
- examples/build.gradle.kts: add kotlinx-coroutines-core dependency
  (examples use runBlocking which requires coroutines on classpath)

Kotlin tests now pass: 7/7 (SmokeTests).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests run against a real antd daemon (default http://127.0.0.1:51105,
override via ANTD_TEST_URL env var). All gracefully skip when no
daemon is reachable, so CI still passes without infrastructure.

- antd-go: 8 integration tests (health, error mapping for no-wallet,
  invalid address, missing upload_id, no-peers cost)
- antd-py: 7 integration tests (health, BadRequestError for invalid
  hex, NotFoundError for valid-but-missing address, ServiceUnavailable
  for wallet ops, error for cost without peers)
- antd-js: 8 integration tests (health, ServiceUnavailableError,
  BadRequestError, AntdError, NetworkError on unreachable port)

Verified all 23 tests passing against antd in local mode (no wallet,
no peers).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
22 tests covering all REST client operations: health, data (public/
private), chunks, wallet, archives, files, external signer, and error
mapping for 6 HTTP status codes. Uses a lightweight HttpListener-based
mock server — no external mocking libraries required.

C# now has parity with the other SDK test suites.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Nic-dorman
Nic-dorman merged commit 63f2c9a into fix/code-review-findings Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant