Expand description
Test doubles — MemoryConnection and fake_database.
A repository test should not need a database. This fake records the SQL a repository emits and replays queued rows, so the behaviour around the query — the hooks, the pagination arithmetic, the not-found handling, the shard route chosen — is testable with no server, schema or migration.
It is not a SQL engine: it never parses the statements it is given. Use it to test the layer above the ORM, and a real SQLite executor to test the SQL itself.
Structs§
- Memory
Connection - A
Connectionthat records statements and replays queued rows. - Recorded
Statement - One recorded statement.
Functions§
- fake_
database - A
Databaseover aMemoryConnection, plus a handle to the connection for assertions.