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
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"meta": {
|
||||
"name": "Bulk Dismiss Conflicts",
|
||||
"type": "http",
|
||||
"event": [
|
||||
{
|
||||
"listen": "test",
|
||||
"script": {
|
||||
"exec": [
|
||||
"// Test bulk dismiss response",
|
||||
"if (response.status === 200) {",
|
||||
" tests['Bulk dismiss successful'] = true;",
|
||||
" const body = JSON.parse(response.body);",
|
||||
" tests['Has results array'] = Array.isArray(body.results);",
|
||||
" tests['Has total count'] = body.total !== undefined;",
|
||||
" tests['Has success count'] = body.success !== undefined;",
|
||||
" tests['Has failed count'] = body.failed !== undefined;",
|
||||
"} else {",
|
||||
" tests['Bulk dismiss failed'] = false;",
|
||||
"}"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"req": {
|
||||
"url": "{{baseUrl}}/api/conflicts/bulk-dismiss",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer {{authToken}}"
|
||||
},
|
||||
"body": {
|
||||
"conflict_ids": [
|
||||
"{{conflictId1}}",
|
||||
"{{conflictId2}}"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"meta": {
|
||||
"name": "Bulk Resolve Conflicts",
|
||||
"type": "http",
|
||||
"event": [
|
||||
{
|
||||
"listen": "test",
|
||||
"script": {
|
||||
"exec": [
|
||||
"// Test bulk resolution response",
|
||||
"if (response.status === 200) {",
|
||||
" tests['Bulk resolve successful'] = true;",
|
||||
" const body = JSON.parse(response.body);",
|
||||
" tests['Has results array'] = Array.isArray(body.results);",
|
||||
" tests['Has total count'] = body.total !== undefined;",
|
||||
" tests['Has success count'] = body.success !== undefined;",
|
||||
" tests['Has failed count'] = body.failed !== undefined;",
|
||||
" tests['Total equals sum of success and failed'] = body.total === body.success + body.failed;",
|
||||
"} else {",
|
||||
" tests['Bulk resolve failed'] = false;",
|
||||
"}"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"req": {
|
||||
"url": "{{baseUrl}}/api/conflicts/bulk-resolve",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer {{authToken}}"
|
||||
},
|
||||
"body": {
|
||||
"conflict_ids": [
|
||||
"{{conflictId1}}",
|
||||
"{{conflictId2}}",
|
||||
"{{conflictId3}}"
|
||||
],
|
||||
"strategy": "most_recent"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"meta": {
|
||||
"name": "Bulk Resolve with Highest Progress Strategy",
|
||||
"type": "http",
|
||||
"event": [
|
||||
{
|
||||
"listen": "test",
|
||||
"script": {
|
||||
"exec": [
|
||||
"// Test highest progress strategy",
|
||||
"if (response.status === 200) {",
|
||||
" tests['Highest progress strategy successful'] = true;",
|
||||
" const body = JSON.parse(response.body);",
|
||||
" tests['At least one conflict resolved'] = body.success > 0;",
|
||||
"} else {",
|
||||
" tests['Strategy failed'] = false;",
|
||||
"}"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"req": {
|
||||
"url": "{{baseUrl}}/api/conflicts/bulk-resolve",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer {{authToken}}"
|
||||
},
|
||||
"body": {
|
||||
"conflict_ids": [
|
||||
"{{conflictId1}}"
|
||||
],
|
||||
"strategy": "highest_progress"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user