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.

47 lines
1.5 KiB
Markdown

+++
title = "Test suite: GET /api/quotes — pagination (page=1, page=N, out-of-range), author filter, tag filter, no results"
priority = 5
status = "todo"
ticket_type = "task"
dependencies = ["ce1e4f", "9b581f", "886bfd"]
+++
<context>
Integration tests live in `tests/` and exercise the API binary against a temporary SQLite database. They run with `cargo test` and must not require a running Cloudflare environment. The test harness spawns the API server on a random port and returns the base URL.
</context>
<goal>
Write the `GET /api/quotes` test suite in `tests/test_list_quotes.rs` (or similar). Test cases:
1. Pagination — page=1 with 15 quotes returns 10, page=2 returns 5; verify total_count, total_pages
2. Out-of-range page — returns empty `quotes` array, not 404
3. Author filter — `?author=X` returns only quotes by that author (case-insensitive)
4. Tag filter — `?tag=X` returns only quotes with that tag
5. Combined filters — author + tag
6. No results — filters that match nothing return empty array with total_count=0
</goal>
<constraints>
- Use the shared test harness from ticket 9b581f.
- Seed multiple quotes before running filter tests.
- Page size is 10 — tests that rely on pagination must seed at least 11 quotes.
</constraints>
<skills>
Use `superpowers:verification-before-completion` before closing.
</skills>
<validation>
Run in order from the `quotesdb/` directory:
```sh
cargo fmt
cargo check
cargo clippy
cargo test
```
</validation>
<commit>
`test(quotesdb): add GET /api/quotes test suite — pagination and filters`
</commit>