Apply London (mock-based) and Chicago (state-based) TDD schools. Use when practicing test-driven development or choosing testing style for your context.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Instruções da origem · Visualização somente leitura
name
tdd-london-chicago
description
Apply London (mock-based) and Chicago (state-based) TDD schools. Use when practicing test-driven development or choosing testing style for your context.
Philosophy: Test observable behavior through public API. Keep tests close to consumer usage.
// State verification - test final outcomedescribe('Order', () => {
it('calculates total with tax', () => {
const order = newOrder();
order.addItem(newProduct('Widget', 10.00), 2);
order.addItem(newProduct('Gadget', 15.00), 1);
expect(order.totalWithTax(0.10)).toBe(38.50);
});
});
When Chicago Shines:
Domain logic with clear state
Algorithms and calculations
Value objects (Money, Email)
Simple collaborations
Learning new domain
London School (Mock-Based)
Philosophy: Test each unit in isolation. Focus on how objects collaborate.
Chicago: Test state, use real objects, refactor freely
London: Test interactions, mock dependencies, design interfaces first
Both: Write the test first, make it pass, refactor
Neither is "right." Choose based on context. Mix as needed. Goal: well-designed, tested code.
With Agents: Agents excel at generating tests, validating green phase, and suggesting refactorings. Use agents to maintain TDD discipline while humans focus on design decisions.
Gotchas
Agent skips Red phase and writes test + implementation together — enforce "test must fail first" by running test before writing code
London school over-mocking creates brittle tests that break on any refactor — mock at architectural boundaries, not every function
Chicago school tests become slow as integration scope grows — keep test boundaries tight
Agent defaults to jest.mock() for everything — prefer dependency injection for testability
Refactor phase is where agent cuts corners most — verify no behavior changes by checking test output is identical