Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ mod tests {
println!("List files response: {:?}", list_files_resp);

// Now check if the response is an array directly
if let Some(files_array) = list_files_resp.as_array() {
if let Some(files_array) = list_files_resp.get("files").and_then(|v| v.as_array()) {
assert_eq!(files_array.len(), 1, "There should be one file in the repo");

// Ensure the file name matches what we uploaded
Expand Down Expand Up @@ -225,13 +225,14 @@ mod tests {
let list_files_after_deletion_resp: serde_json::Value =
test::call_and_read_body_json(&app, list_files_after_deletion_req).await;

assert!(
list_files_after_deletion_resp
.as_array()
.unwrap()
.is_empty(),
"File list should be empty after file deletion"
);
if let Some(files_array) = list_files_after_deletion_resp.get("files").and_then(|v| v.as_array()) {
assert!(
files_array.is_empty(),
"File list should be empty after file deletion"
);
} else {
panic!("The response does not contain the 'files' array as expected");
}

// Clean up: Stop the backend
{
Expand Down