← Files get-fableARCHIVED FILE

skills/fable-tdd/examples/failing-test-first.md

387 Bytes · Oct 5, 2026 · 18:31 UTC

↓ Download file

# Example: Adding a Discount Calculator via TDD

## Steps
1. Write test in `test/discount.test.ts` for 20% loyalty discount.
2. Run `bun test test/discount.test.ts` -> OBSERVE RED: `calculateDiscount is not a function`.
3. Implement `calculateDiscount(price, rate)` in `src/discount.ts`.
4. Run `bun test test/discount.test.ts` -> OBSERVE GREEN: `1 pass`.
5. Hand off to `fable-verify`.

SHA-256: a502fc0b70eedd8f6705895dd088fda4cf6adfb6fbd7f0458dd694232f61c4c5