Skip to content

test: node-sdk Foundation + Modules test coverage (Phases 5-6)#10

Merged
Tsabary merged 22 commits into
mainfrom
test/sdk-coverage
Jun 22, 2026
Merged

test: node-sdk Foundation + Modules test coverage (Phases 5-6)#10
Tsabary merged 22 commits into
mainfrom
test/sdk-coverage

Conversation

@Tsabary

@Tsabary Tsabary commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Foundation: a shared makeClient() mock-client test helper, full coverage of SublayHttpClient construction + SublayClient.init/verifyClient, and a GitHub Actions workflow that gates publish-prod/publish-beta on pnpm test passing.
  • Modules: request-shaping + response-mapping tests for every module bound on SublayClient — tables/tables-management, entities, comments, users, collections, follows, connections, spaces (lifecycle/membership/moderation+rules+digest), search, appNotifications, auth, hostedApps+reports, storage, chat, and events. oauth is correctly left untested (genuinely unbound).
  • Docs fix: events (14 functions) was bound on SublayClient but missing from CLAUDE.md's module list and module count. Added the missing section, renumbered the module list 1-15, and dropped a stale "chat/storage previously deferred" callout now that both are ordinary bound modules.

360 tests across 19 suites, all passing.

Test plan

  • pnpm test — 360/360 passing
  • tsc --noEmit -p tsconfig.jest.json — clean
  • CI workflow (.github/workflows/test.yml) runs the suite on PRs/pushes to main

Tsabary and others added 20 commits June 22, 2026 14:56
Generalizes the ad hoc makeClient() from tables.test.ts into an importable
helper under __tests__/helpers/ so other module test files can get a
SublayHttpClient-shaped object with mocked projectInstance/internalInstance/
baseInstance axios methods.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests the three axios instances' baseURL/header setup (including the
isInternal flag) and SublayClient.init's verify-success/verify-failure
paths via a mocked axios.create.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Runs the jest suite on every PR and push to main, and gates
publish-prod/publish-beta (and their :patch/:minor variants) on tests
passing first.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Existing tests only asserted request shaping; this adds coverage for
how each function unwraps/returns the axios response (response.data.row,
.rows, the full envelope, etc.) for both row ops and DDL.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests all 16 functions in src/modules/entities/, including
fetchManyEntities' object-shaped filter params (keywordsFilters,
metadataFilters) passed through to axios as-is.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests all 10 functions in src/modules/comments/.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests all 19 functions in src/modules/users/ (profile, graph queries,
and the nested follow/connection actions). The graph-action tests
explicitly confirm actingUserId travels in the body/params while
userId (the target) stays in the path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests all 8 functions in src/modules/collections/.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests all 5 functions in src/modules/follows/.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests all 7 functions in src/modules/connections/.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests createSpace, deleteSpace, updateSpace, fetchSpace,
fetchManySpaces, fetchSpaceByShortId, fetchSpaceBySlug,
checkSlugAvailability, fetchUserSpaces, fetchChildSpaces,
fetchSpaceBreadcrumb, and fetchMutualSpaces.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests joinSpace, leaveSpace, checkMyMembership, fetchSpaceMembers,
fetchSpaceTeam, updateMemberRole, approveMembership,
declineMembership, banMember, and unbanMember.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests handleEntityReport/handleCommentReport (with multi-action
arrays), moderateSpaceEntity/moderateSpaceComment,
getSpaceConversation, the service-key god-mode chat moderation
routes (moderateSpaceChatMessage/handleSpaceChatReport — confirmed
to pass actingUserId through as attribution-only with no extra
client-side gating), rules CRUD + reorder, and digest config.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests all 4 functions in src/modules/search/. node-sdk's askContent
is a plain POST (unlike js-sdk's SSE version), confirmed here and
tested with the standard axios mock rather than stream-mocking.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…apping)

Tests all 4 functions in src/modules/app-notifications/.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests all 10 functions in src/modules/auth/.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests fetchHostedApp (confirming it hits internalInstance, not
projectInstance), createReport, and fetchModeratedReports.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests uploadFile/uploadImage's multipart FormData construction
(file blob + JSON-stringified object fields, default filename,
undefined-field skipping), exercising 2 of the 5 imageOptions modes
(exact-dimensions, aspect-ratio-width-based) plus getFile/deleteFile.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Split into two files matching the conversations+members vs.
messages+reactions+read-state line: chat-conversations.test.ts (12
functions) and chat-messages.test.ts (9 functions).

Covers all 20 bound chat functions, distinguishes listConversations'
and listMessages' raw-array+hasMore cursor pagination from
listMembers'/listReactions' PaginatedResponse offset pagination, and
tests sendMessage's multipart-with-files path alongside its
plain-JSON path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
An audit found that client.events (14 functions, bound via
bindModule(Events, this.http) in src/index.ts) had zero test
coverage and was never enumerated in Phase 6 — it landed via
feat/events-bundle, merged just before Phase 5 started, and nobody
updated the task list or CLAUDE.md to add it. js-sdk's Task 8.14
already flags the equivalent staleness for js-sdk's own events
module; node-sdk's Phase 6 missed the same catch.

- Add events.test.ts covering all 14 functions (request shaping +
  response mapping).
- Fix CLAUDE.md: add the missing Events Module section, renumber the
  module list 1-15, correct "14 modules" -> "15 modules" in both
  places, and add events/ to the directory tree.
- Drop the stale "chat and storage were previously deferred... now
  bound" callout — they're ordinary bound modules now with nothing
  left to flag, and the leftover note was the same kind of
  wiring-status staleness that caused the events gap in the first
  place.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Tsabary Tsabary self-assigned this Jun 22, 2026
Tsabary and others added 2 commits June 22, 2026 15:45
pnpm-workspace.yaml here only declares allowBuilds (a settings-only
file, not a real workspace), but pnpm v9 requires a packages: field
whenever that file exists at all -- it fails actions/setup-node's
caching step with "ERROR packages field missing or empty" when
running `pnpm store path`. pnpm v10+ treats a packages-less
pnpm-workspace.yaml as settings-only and handles it fine. Bumped to
v11 to match the local dev pnpm version.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
pnpm v11 requires Node >=22.13, but this workflow installs Node 20,
so actions/setup-node's caching step crashed trying to run pnpm
itself. pnpm v10 only requires Node >=18.12 and still treats a
packages-less pnpm-workspace.yaml as settings-only (the actual fix
from the previous commit), so it satisfies both constraints without
also bumping the job's Node version.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Tsabary Tsabary merged commit a3127cc into main Jun 22, 2026
1 check passed
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