Add comprehensive Bruno tests for Phase 9 limitations features: Test Collection Rules.bru: - Test rule: genre equals "Science Fiction" - Test rule: author contains "Asimov" - Test rule: copyright_year greater than 2000 - Test rule: non-existent genre (expects 0 matches) - Test validation: empty rules array (expects 400) Bulk Remove Books.bru: - Setup: Create test collection - Add multiple books to collection - Test 1: Bulk remove all books - Test 2: Bulk remove with some invalid IDs - Test 3: Empty list validation - Test 4: Single book removal (bulk should work for 1 too) - Cleanup: Delete test collection Test Coverage: - Rule evaluation API endpoint - Bulk remove API endpoint - Request validation - Response structure verification - Edge cases and error handling Bruno Test Format: - JSON request bodies - Status code assertions - Response structure validation - Setup/teardown for integration tests These tests ensure the new Phase 9 API endpoints work correctly and maintain backward compatibility.
84 lines
1.2 KiB
Plaintext
84 lines
1.2 KiB
Plaintext
meta {
|
|
name: "Test Collection Rules"
|
|
type: http
|
|
seq: 1
|
|
}
|
|
|
|
post {
|
|
url: {{baseUrl}}/api/collections/test-rules
|
|
body: {
|
|
rules: [
|
|
{
|
|
field: "genre",
|
|
operator: "equals",
|
|
value: "Science Fiction"
|
|
}
|
|
]
|
|
}
|
|
assert {
|
|
res.status: 200
|
|
res.body.matches: #array
|
|
res.body.total: #number
|
|
}
|
|
}
|
|
|
|
post {
|
|
url: {{baseUrl}}/api/collections/test-rules
|
|
body: {
|
|
rules: [
|
|
{
|
|
field: "author",
|
|
operator: "contains",
|
|
value: "Asimov"
|
|
}
|
|
]
|
|
}
|
|
assert {
|
|
res.status: 200
|
|
res.body.matches: #array
|
|
}
|
|
}
|
|
|
|
post {
|
|
url: {{baseUrl}}/api/collections/test-rules
|
|
body: {
|
|
rules: [
|
|
{
|
|
field: "copyright_year",
|
|
operator: "greater_than",
|
|
value: "2000"
|
|
}
|
|
]
|
|
}
|
|
assert {
|
|
res.status: 200
|
|
}
|
|
}
|
|
|
|
post {
|
|
url: {{baseUrl}}/api/collections/test-rules
|
|
body: {
|
|
rules: [
|
|
{
|
|
field: "genre",
|
|
operator: "equals",
|
|
value: "NonExistentGenre123456"
|
|
}
|
|
]
|
|
}
|
|
assert {
|
|
res.status: 200
|
|
res.body.total: 0
|
|
}
|
|
}
|
|
|
|
post {
|
|
url: {{baseUrl}}/api/collections/test-rules
|
|
body: {
|
|
rules: []
|
|
}
|
|
assert {
|
|
res.status: 400
|
|
}
|
|
}
|