Files
bookhoard/bruno/analytics/Get Popular Books.bru
T
john-okeefe 2df5ca3325 test(api): add Bruno tests for analytics, books, and bulk operations
Analytics:
- Reading stats endpoint tests
- Device usage tests
- Popular books tests

Books:
- Bulk delete tests
- Bulk update tests

Collections:
- Bulk add books to collections tests

Conflicts:
- Bulk resolve conflicts tests
- Bulk dismiss conflicts tests
- Bulk resolve highest progress tests

All tests cover no user, user, and admin contexts
2026-02-01 12:16:07 -05:00

37 lines
1.2 KiB
Plaintext

{
"meta": {
"name": "Get Popular Books",
"type": "http",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Test popular books response",
"if (response.status === 200) {",
" tests['Popular books loaded'] = true;",
" const body = JSON.parse(response.body);",
" tests['Has books array'] = Array.isArray(body.books);",
" if (body.books.length > 0) {",
" tests['Book has title'] = body.books[0].title !== undefined;",
" tests['Book has author'] = body.books[0].author !== undefined;",
" tests['Book has read_count'] = body.books[0].read_count !== undefined;",
" tests['Book has avg_completion'] = body.books[0].avg_completion !== undefined;",
" }",
"} else {",
" tests['Popular books failed'] = false;",
"}"
]
}
}
]
},
"req": {
"url": "{{baseUrl}}/api/analytics/popular-books?limit=10",
"method": "GET",
"headers": {
"Authorization": "Bearer {{authToken}}"
}
}
}