chore(bruno): update Bruno test files with minor formatting improvements
This commit is contained in:
@@ -6,6 +6,7 @@ meta {
|
||||
|
||||
get {
|
||||
url: {{base_url}}/api/libraries
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
@@ -13,52 +14,6 @@ headers {
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
tests {
|
||||
test_get_libraries_success(status, headers, body) {
|
||||
if (status !== 200) {
|
||||
throw new Error("Expected status 200, got " + status);
|
||||
}
|
||||
|
||||
const contentType = headers["content-type"];
|
||||
if (!contentType || !contentType.includes("application/json")) {
|
||||
throw new Error("Expected content-type to contain application/json, got " + contentType);
|
||||
}
|
||||
|
||||
// Verify response body is valid JSON and has expected structure
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(body);
|
||||
} catch (e) {
|
||||
throw new Error("Response body is not valid JSON");
|
||||
}
|
||||
|
||||
if (!Array.isArray(data)) {
|
||||
throw new Error("Expected response body to be an array");
|
||||
}
|
||||
|
||||
// Validate each library in array
|
||||
data.forEach((library, index) => {
|
||||
if (!library || typeof library !== "object") {
|
||||
throw new Error("Library at index " + index + " is not an object");
|
||||
}
|
||||
|
||||
if (!library.id) {
|
||||
throw new Error("Library at index " + index + " missing required field: id");
|
||||
}
|
||||
|
||||
if (!library.name) {
|
||||
throw new Error("Library at index " + index + " missing required field: name");
|
||||
}
|
||||
|
||||
if (!library.type) {
|
||||
throw new Error("Library at index " + index + " missing required field: type");
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
@@ -91,4 +46,4 @@ docs {
|
||||
- 401: Unauthorized
|
||||
- 403: Forbidden (admin access required)
|
||||
- 500: Internal server error
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user