Skip to content

refactor: Add a shared Apify client test mock #1251

Description

@jirispilka

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions