Skip to content

Replace module mocks with Effect dependency injection #172

Open

Description

@flamboh

problem

The anti-slop migration in #171 exposes 50 vi.mock calls across 23 test files. Whole-module mocks couple tests to import topology, can drift from production behavior, and make refactors noisy.

direction

Replace the internal workflow mocks with a few real dependency seams. Prefer Effect services and layers where the production code already uses Effect:

  1. Import workflow: audio backend, provider lookup, downloads, metadata decoding, and analytics.
  2. Share workflow: share client, publication capability storage, presence, cover processing, notifications, and analytics.
  3. Export/workspace workflow: download execution, system-failure reporting, audio backend, notifications, and analytics.
  4. UI-library mocks: render the real shadcn/DnD behavior where practical, or test the underlying controller through its interface. Do not invent production interfaces solely to replace a third-party UI mock.

Each seam should have both a live adapter and a test adapter. New tests should exercise behavior through the workflow interface; remove the superseded shallow tests instead of layering duplicate coverage.

acceptance criteria

  • No vi.mock, vi.doMock, or equivalent whole-module mocks remain in tests/**.
  • Import, share, export, and workspace behavior retain focused coverage through real interfaces.
  • Test adapters are typed and faithful to the live interface.
  • Obsolete implementation-coupled tests are removed.
  • anti-slop/no-module-mocking can be promoted from warning to error.
  • Lint, typecheck, unit/server tests, and the relevant browser flows pass.

non-goals

  • Rewriting unrelated production modules.
  • Adding pass-through interfaces with only one adapter.
  • Preserving tests whose only value is asserting implementation details.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions