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.
51 lines
1.6 KiB
Markdown
51 lines
1.6 KiB
Markdown
---
|
|
# quotesdb-zc1j
|
|
title: 'Test suite: PUT /api/quotes — create (auto auth_code, custom auth_code, missing fields 422)'
|
|
status: completed
|
|
type: task
|
|
priority: normal
|
|
created_at: 2026-03-10T23:32:06Z
|
|
updated_at: 2026-03-10T23:32:14Z
|
|
blocked_by:
|
|
- quotesdb-gu9j
|
|
- quotesdb-a0q1
|
|
---
|
|
|
|
<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 `PUT /api/quotes` test suite in `tests/test_create_quote.rs` (or similar). Test cases:
|
|
1. Create with auto-generated auth_code — verify 201, quote object returned, auth_code present in response
|
|
2. Create with custom auth_code in body — verify the provided code is stored and returned
|
|
3. Missing `text` field — verify 422 Unprocessable Entity
|
|
4. Missing `author` field — verify 422 Unprocessable Entity
|
|
5. Create with tags — verify tags appear in the returned quote
|
|
</goal>
|
|
|
|
<constraints>
|
|
- Use the shared test harness from ticket 9b581f.
|
|
- Auth code in the response must match the pattern `word-word-word-word`.
|
|
- Verify the created quote is retrievable via `GET /api/quotes/:id` after creation.
|
|
</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 PUT /api/quotes test suite — create quote`
|
|
</commit>
|