You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vibed/quotesdb/.beans/quotesdb-kh9l--write-unit-t...

1.9 KiB

title status type priority created_at updated_at blocked_by
Write unit tests in api/src/tests.rs covering all handlers, auth logic, and pagination completed task normal 2026-03-10T23:32:09Z 2026-03-10T23:32:17Z
quotesdb-l4e9
quotesdb-nrue
quotesdb-4gqi
quotesdb-a0q1
quotesdb-bz2v
quotesdb-ode0
quotesdb-753n
The `quotesdb` API is built with Axum + Tokio, targeting Cloudflare Workers via `workers-rs`. It serves JSON at `/api/*` endpoints and persists data to Cloudflare D1 (production) or a local SQLite file via Turso (development). Source lives in `src/bin/api/`.

Shared types and utilities are in src/lib.rs — code placed there must compile for both the host target and wasm32-unknown-unknown.

Write unit tests in `src/bin/api/tests.rs` (or a `#[cfg(test)]` module) covering all API handlers, the auth logic, and pagination calculations. Unit tests should test handler logic in isolation using mock or in-memory databases where possible. - Unit tests must run with `cargo test` on the host target — no WASM or browser context required. - Test auth code matching logic (correct code → pass, wrong code → 403). - Test pagination edge cases: page 1, last page, out-of-range page (empty array). - Test tag insertion and replacement (correct rows added/removed). - Aim for 80%+ code coverage of the API handler module. Use `superpowers:test-driven-development` throughout implementation — unit tests should already exist from prior tickets. Use `superpowers:verification-before-completion` before closing. Run in order from the `quotesdb/` directory:
cargo fmt
cargo check
cargo clippy
cargo test
`test(quotesdb): add unit tests for api handlers, auth logic, and pagination`