Files
bookhoard/bruno/collections/Test Collection Rules - Copyright Year Greater Than.bru
T
john-okeefe 26070e4000 Refactor: rename baseUrl to base_url in .bru files
Update configuration key naming convention to use snake_case
consistently.
Applies changes recursively across all subdirectories.
2026-02-08 21:26:31 -05:00

64 lines
1.5 KiB
Plaintext

meta {
name: Test Collection Rules - Copyright Year Greater Than
type: http
seq: 3
}
post {
url: {{base_url}}/api/collections/test-rules
body: json
auth: inherit
}
headers {
Content-Type: application/json
Authorization: Bearer {{authToken}}
}
body:json {
{
"rules": [
{
"field": "copyright_year",
"operator": "greater_than",
"value": "2000"
}
]
}
}
script:post-response {
function onResponse(res) {
if (res.getStatus() === 200) {
tests['Year comparison successful'] = true;
const body = res.getBody();
tests['Has matches array'] = Array.isArray(body.matches);
tests('Found books after 2000', body.matches.length >= 0);
} else {
tests['Year comparison failed'] = false;
}
}
onResponse(res);
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Test Collection Rules - Copyright Year Greater Than
Tests the "greater_than" operator on the copyright_year field to find books published after a specific year.
**Example Use Case:** Creating a "Modern Books" collection with books published after 2000.
**Operator:** `greater_than` - Matches if the field value is greater than the specified value (numeric comparison).
**Field:** `copyright_year` - The year the book was copyrighted/published.
**Expected Result:** Returns all books with copyright_year greater than 2000 (i.e., published in 2001 or later).
**Purpose:** Demonstrates numeric comparison operators for creating date-based collections, useful for organizing books by publication era.
}