Context
Unit tests contain 32 unsafe Apify client casts across 16 files, usually inside repeated local client stubs.
Scope
- Add
mockApifyClient() to tests/unit/helpers/tool_context.ts.
- Centralize the unsafe cast in that helper.
- Accept explicit top-level client method overrides.
- Migrate existing local stubs where the helper preserves their behavior and spies.
- Keep resource-specific behavior visible in each test.
Out of scope
- Production code changes.
- A generic mock that invents resource behavior.
Done when
- Unsafe Apify client casts are centralized in the shared helper.
- Existing unit tests pass.
- Required repository checks pass.
Split from #1065 after verification.
Context
Unit tests contain 32 unsafe Apify client casts across 16 files, usually inside repeated local client stubs.
Scope
mockApifyClient()totests/unit/helpers/tool_context.ts.Out of scope
Done when
Split from #1065 after verification.