Update and create Bruno API tests to reflect new unified collections architecture:
Updated Tests:
1. get-dashboard-sections.yml
- Updated response structure documentation
- Changed from type field to is_system boolean
- Changed from id to media_item_id in items
- Added priority field documentation
- Updated example response to show unified collections structure
- Added test for sections array in response
2. update-preferences.yml
- Changed HTTP method from POST to PUT (matching handler implementation)
- Updated request body field names:
* hidden_sections → hidden_collections
* section_order → collection_order
- Updated documentation with new field names
- Updated example request with valid system collection names
New Tests:
3. restore-system-collection.yml
- Tests POST /api/dashboard/restore-system-collection endpoint
- Validates collection_name against allowed system collections
- Tests success response with message
- Documents valid collection names:
* continue-reading
* recently-added
* recently-read
* not-started
Test Coverage:
- GET /api/dashboard/sections: Returns all dashboard sections
- PUT /api/dashboard/preferences: Updates user preferences
- POST /api/dashboard/restore-system-collection: Resets system collection
All tests follow Bruno YAML format with proper authentication via auth: inherit.
48 lines
1.3 KiB
YAML
48 lines
1.3 KiB
YAML
info:
|
|
name: Restore System Collection
|
|
type: http
|
|
seq: 3
|
|
http:
|
|
method: POST
|
|
url: '{{base_url}}/api/dashboard/restore-system-collection'
|
|
auth: inherit
|
|
body:
|
|
type: json
|
|
jsonBody: "{\n \"collection_name\": \"continue-reading\"\n}"
|
|
runtime:
|
|
scripts:
|
|
- type: tests
|
|
code: "test(\"status must be 200 with valid collection\", function() {\n expect(res.status).to.eql(200);\n\
|
|
});\n\ntest(\"response has success message\", function() {\n expect(res.body.message).to.exist;\n\
|
|
});"
|
|
|
|
docs: |-
|
|
Restore a system collection to its default state.
|
|
|
|
**Endpoint**: POST /api/dashboard/restore-system-collection
|
|
**Auth**: Required (Bearer token)
|
|
|
|
## Request Body
|
|
|
|
| Field | Type | Required | Description |
|
|
|-------|------|----------|-------------|
|
|
| collection_name | string | Yes | Name of system collection to restore |
|
|
|
|
Valid collection names:
|
|
- `continue-reading`: Books you're currently reading (0 < progress < 1)
|
|
- `recently-added`: Newly added items to this library
|
|
- `recently-read`: Books you've finished (progress >= 1)
|
|
- `not-started`: Books you haven't read yet (progress = 0 or no record)
|
|
|
|
## Example Request
|
|
|
|
```json
|
|
{
|
|
"collection_name": "continue-reading"
|
|
}
|
|
```
|
|
|
|
## Response
|
|
|
|
Returns success message on restore.
|