testing-patterns
Testing Patterns & Effect Abstraction
Short version: model your “effects” as traits, inject them, keep core logic pure, and provide real + fake implementations. That’s the idiomatic Rust way; free monads aren’t a thing here.
Pattern
- Define algebras as traits (ports).
- Implement adapters for prod (HTTP, DB, clock, FS) and for tests (fakes/mocks).
- Inject via generics (zero-cost, monomorphized) or trait objects (
dyn Trait) when you need late binding. - Keep domain functions pure; pass in effect results or tiny capability traits.
Minimal sync example
use std::time::{SystemTime, UNIX_EPOCH};
pub trait Clock {
More from lambdamechanic/skills
dumbwaiter-mcp
Provider-agnostic wait-for-change skill that uses the Dumbwaiter MCP server to wait on PR events (GitHub first) via wait.start/status/cancel/await, with progress notifications and durable state.
60rust-guidelines
Pragmatic Rust conventions to keep code readable, testable, and performant for this project.
9landing-the-plane
Checklist for finishing work, pushing a branch, and opening a ready-for-review PR with tests and tracker updates.
8python
Default Python stack for Lambda: uv + Astral tools, typed code, schemas, and Hypothesis.
6typescript
Default TypeScript stack for Lambda: pnpm workspaces + Turbo, strict TS, and sensible DX helpers.
6galahad
how to approach tests, types and coverage
5