Skip to content

test: add downloads, export, and type contracts - #227

Draft
derekmeegan wants to merge 2 commits into
feat/downloadsfrom
test/downloads-contracts
Draft

derekmeegan wants to merge 2 commits into
feat/downloadsfrom
test/downloads-contracts

Conversation

@derekmeegan

Copy link
Copy Markdown
Contributor

Moves the Node SDK contract tests from browserbase/browserbase-stlc-config#39 into this repo's CI, for the one-repo flow.

  • tests/lib/downloads.test.ts covers downloads pagination, metadata, deletion, errors, the legacy ZIP endpoint, streaming with backpressure, empty files, and aborts. Every case runs twice: under the default native fetch and under node-fetch.
  • tests/lib/exports.test.ts covers the default and named exports, the resource classes (now including Downloads), the error classes, and the utilities.
  • tests/lib/sdk-types.ts is the type-level contract. It isn't a jest file; ./scripts/lint type-checks it.

This is stacked on feat/downloads, the preview build of browserbase/browserbase-stlc-config#75. Retarget it to main after #75 merges, then merge this right away: until then, main's CI fails the generated downloads test.

One edit to a generated file. The second commit makes tests/api-resources/downloads.test.ts import Response from the SDK shim instead of node-fetch. Every other resource test already carries this as a sealed patch. Without it, the preview's CI fails that file three times with "Expected constructor: Response", because the default Node runtime uses native fetch. The release-sdk skill says never to edit generated files, so if there's a better fix, I'll drop this commit.

What's lost from the config-repo version. The export checks now run against src through jest's module mapping, not against the built package. So the CommonJS module.exports shape is no longer asserted. ./scripts/build still smoke-tests require and import of dist.

Locally, ./scripts/lint passes, and ./scripts/test passes all 208 tests against the mock server.

🤖 Generated with Claude Code

derekmeegan and others added 2 commits November 4, 2026 18:40
Moved from browserbase-stlc-config, where they ran against the generated
output before custom code was applied. Here they run in this repo's CI:
jest picks up the two test files and ./scripts/lint type-checks sdk-types.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The default Node runtime uses native fetch, so node-fetch's Response
fails the generated instanceof checks, as in every other resource test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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