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.
49 lines
1.4 KiB
YAML
49 lines
1.4 KiB
YAML
info:
|
|
name: Update Dashboard Preferences
|
|
type: http
|
|
seq: 2
|
|
http:
|
|
method: PUT
|
|
url: '{{base_url}}/api/dashboard/preferences'
|
|
auth: inherit
|
|
body:
|
|
type: json
|
|
jsonBody: "{\n \"library_id\": \"{{library_id}}\",\n \"hidden_collections\"\
|
|
: [\"not-started\"],\n \"collection_order\": [\"recently-added\", \"continue-reading\"\
|
|
, \"recently-read\"],\n \"items_per_section\": 20\n}"
|
|
runtime:
|
|
scripts:
|
|
- type: tests
|
|
code: "test(\"status must be 200 with valid request\", function() {\n expect(res.status).to.eql(200);\n\
|
|
});"
|
|
|
|
docs: |-
|
|
Update dashboard preferences for the authenticated user.
|
|
|
|
**Endpoint**: PUT /api/dashboard/preferences
|
|
**Auth**: Required (Bearer token)
|
|
|
|
## Request Body
|
|
|
|
| Field | Type | Required | Description |
|
|
|-------|------|----------|-------------|
|
|
| library_id | string | Yes | Library UUID |
|
|
| hidden_collections | array | No | Collection names to hide from dashboard |
|
|
| collection_order | array | No | Collection names in custom display order |
|
|
| items_per_section | int | No | Items to show per section (default: 20) |
|
|
|
|
## Example Request
|
|
|
|
```json
|
|
{
|
|
"library_id": "cc23c3a7-f8fb-451a-a78d-2a16df1b725a",
|
|
"hidden_collections": ["not-started"],
|
|
"collection_order": ["recently-added", "continue-reading", "recently-read"],
|
|
"items_per_section": 20
|
|
}
|
|
```
|
|
|
|
## Response
|
|
|
|
Returns updated preferences object on success.
|