Skip to content

feat: 30 - test mocking patterns#32

Open
miroslavpojer wants to merge 4 commits into
masterfrom
feature/30---Add-skill---test-mocking-patterns
Open

feat: 30 - test mocking patterns#32
miroslavpojer wants to merge 4 commits into
masterfrom
feature/30---Add-skill---test-mocking-patterns

Conversation

@miroslavpojer

Copy link
Copy Markdown
Contributor

Adds the test-mocking-patterns skill — a focused reference for test double selection and implementation across Python, TypeScript/JavaScript, and Scala.

What it covers

  • Double classification — when to use stub, mock, spy, fake, or dummy based on the nature of the dependency interaction (return value vs side effect vs unused)
  • Pythonpytest-mock / unittest.mock: patch targets, scope and cleanup, responses / pytest-httpx for HTTP stubbing, freezegun for time control, monkeypatch / patch.dict for env vars
  • TypeScript / Jest — module mocking, hoisting behaviour, clearAllMocks / resetAllMocks / restoreAllMocks, spy vs mock distinction
  • Scala / mockito-scala — stub, mock, spy, fake patterns with reset guidance
  • Diagnostics — wrong patch target, mock state bleed, over-specified assertions, private-method testing antipattern, stub returning wrong type
  • Don't mock what you don't own — guidance on wrapping third-party types in a thin protocol before mocking

What's included

Path Description
skills/test-mocking-patterns/SKILL.md Skill body
skills/test-mocking-patterns/evals/evals.json Eval cases (happy path, regression, negative)
skills/test-mocking-patterns/evals/trigger-eval.json Trigger boundary evals
skills/test-mocking-patterns/evals/fixture-map.md Maps eval cases to source fixtures
skills/test-mocking-patterns/evals/files/ Source fixtures used by evals
docs/test-mocking-patterns.md User-facing doc page

Closes #30

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.

Add skill - test-mocking-patterns

1 participant