test: node-sdk Foundation + Modules test coverage (Phases 5-6)#10
Merged
Conversation
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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
makeClient()mock-client test helper, full coverage ofSublayHttpClientconstruction +SublayClient.init/verifyClient, and a GitHub Actions workflow that gatespublish-prod/publish-betaonpnpm testpassing.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.oauthis correctly left untested (genuinely unbound).events(14 functions) was bound onSublayClientbut missing fromCLAUDE.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 passingtsc --noEmit -p tsconfig.jest.json— clean.github/workflows/test.yml) runs the suite on PRs/pushes tomain