Skip to main content

mocking

Use when: use test doubles correctly — mock true boundaries, not the code under test.

Informações da origem

Repositório
kimtth/agent-skill-100-lines-or-less
Última atividade na origem
26 de junho de 2026 às 02:15
Idioma detectado do SKILL.md
inglês
Estrelas
2
Forks
0

Opções de instalação

Por padrão, está selecionado o prompt que primeiro revisa a origem. Você pode mudar para um comando direto ou baixar uma cópia local.

Revise os arquivos de origem

Leia o SKILL.md e os arquivos complementares exibidos pelo SkillsMP antes de decidir se vai instalar.

Exibindo SKILL.md

SKILL.md
Instruções da origem · Visualização somente leitura
name
mocking
description
Use when: use test doubles correctly — mock true boundaries, not the code under test.
Goal: fast, honest tests that isolate the unit without faking its behavior. Use for: - isolating a unit from slow or external dependencies - deciding what to fake versus exercise for real - fixing brittle tests coupled to implementation Workflow: 1. Identify the true external boundary (network, clock, filesystem). 2. Mock or stub only that boundary, not internal collaborators. 3. Use the lightest double that works: stub, fake, or mock. 4. Assert on observable behavior, not on every internal call. 5. Keep doubles in sync with the real contract. 6. Verify the integration with the real dependency elsewhere. Doubles: - stub: returns canned data - fake: a working lightweight implementation - mock: asserts interactions occurred - spy: records calls for later inspection Rules: - do not mock the thing you are testing - prefer real collaborators when they are fast and deterministic - avoid asserting on internal call sequences - verify mocked contracts against reality in integration tests
Ver no GitHub