refactor: Split integration suite into flat per-capability cases - #1202
Draft
MQ37 wants to merge 3 commits into
Draft
refactor: Split integration suite into flat per-capability cases#1202MQ37 wants to merge 3 commits into
MQ37 wants to merge 3 commits into
Conversation
commit: |
Splits tests/integration/suite.ts (3292 lines, 117 cases) into tests/integration/cases/*.cases.ts, grouped flat by capability (registration, tools, actors, apps, tasks, storage, payments), per the plan agreed in #776 (flat structure, no folder-per-tool mirror of src/). Every register*Cases(ctx) is a mechanical move — same test names, bodies, and transport gates; suite.ts now only wires the three transport dimensions and calls the register functions. Verified via AST title diff: 117 titles before, 117 after, zero difference. Adds src/test_kit/ (published behind the "./test-kit" package export, vitest optional peerDependency) so apify-mcp-server-internal can import and run a curated critical: true subset against its own live deploy instead of hand-duplicating assertions. Wires two scenarios (tests/integration/cases/shared_scenarios.ts) through it as a working example; growing that subset is a per-PR judgment call, left for follow-up. Updates AGENTS.md and DEVELOPMENT.md per #776's own requirement to document the new structure when the first capability module lands. Fixes #776 AI use disclosed: mechanical statement extraction (line-range slicing driven by a TypeScript AST parse) was scripted; grouping decisions, the test-kit design, and all verification were reviewed by hand.
MQ37
force-pushed
the
refactor/776-flat-integration-test-cases
branch
from
August 5, 2026 11:13
19bd50d to
c679b71
Compare
Moves createMcpStreamableClient/createMcpStatelessClient from tests/helpers.ts (unpublished test tree) into src/test_kit/mcp_client.ts, exported behind the existing "./test-kit" package export. Widens SuiteClientOptions to a strict superset of apify-mcp-server-internal's own MCPClientOptions: - explicit token?: string | null (omitted -> process.env.APIFY_TOKEN, unchanged default; null -> no Authorization header at all, needed for internal's negative-auth / payment-mode tests where the run's APIFY_TOKEN is set for everything else) - serverMode/payment as plain strings, matching internal's ui/ paymentProvider/skyfireMode fields (same ?ui=/?payment= query params under the hood, one canonical name instead of three) tests/helpers.ts now re-exports these instead of maintaining its own copy; createMcpStdioClient (spawns this repo's own dist/stdio.js, irrelevant to a hosted-deploy consumer) stays local and unpublished. Lets apify-mcp-server-internal delete test/integration/src/mcp-clients.ts entirely and import the same client instead of maintaining its own. Verified: type-check, lint, format, 1267 unit tests, full integration suite collection (356 tests, unchanged), build (dist/test_kit/mcp_client.js), check:agents all pass. Refs #776
Moves registrationCriticalScenarios/actorsCriticalScenarios from tests/integration/cases/shared_scenarios.ts (unpublished test tree) into src/test_kit/scenarios.ts, exported behind the existing "./test-kit" package export. registerScenarios alone wasn't enough — apify-mcp-server-internal needs the actual Scenario[] content to register, not just the registration helper. tests/integration/cases/shared_scenarios.ts now just re-exports from src/ so registration.cases.ts/actors.cases.ts need no changes. Verified: type-check, lint, format, 1267 unit tests, integration suite collection (356, unchanged), build (dist/test_kit/scenarios.js), check:agents. Refs #776
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.
🚧 DO NOT REVIEW — WIP. May be split into multiple PRs once finished.
What
Splits
tests/integration/suite.ts(3292 lines, 117 cases) into flattests/integration/cases/*.cases.tsfiles, grouped by capability (registration, tools, actors, apps, tasks, storage, payments), per the flat structure agreed in #776. Addssrc/test_kit/(./test-kitpackage export,vitestoptional peerDependency) soapify-mcp-server-internalcan run a curatedcritical: truesubset against its own live deploy instead of hand-duplicating assertions — wired for 2 scenarios as a working example.Why
One file, 117 cases, unmaintainable by more than one person at a time. See #776.
Testing
pnpm run type-check,pnpm run lint,pnpm run format,pnpm run test:unit(1267 tests),pnpm run check:agents,pnpm run build(confirmsdist/test_kitoutput) all pass.AI use disclosure
Statement extraction (line-range slicing) was scripted from a TypeScript AST parse of the original file; grouping decisions, the test-kit design, and all verification were done and reviewed by hand.
Fixes #776