fix(tests): resolve integration test response format

This commit is contained in:
perf3ct 2025-07-09 20:10:36 +00:00
parent b1690ede6a
commit 29800bdd1f
4 changed files with 9 additions and 9 deletions

View File

@ -159,7 +159,7 @@ pub async fn delete_low_confidence_documents(
.iter() .iter()
.take(10) // Show max 10 in preview .take(10) // Show max 10 in preview
.map(|doc| serde_json::json!({ .map(|doc| serde_json::json!({
"id": doc.id, "id": doc.id.to_string(),
"filename": doc.original_filename, "filename": doc.original_filename,
"ocr_confidence": doc.ocr_confidence, "ocr_confidence": doc.ocr_confidence,
"created_at": doc.created_at "created_at": doc.created_at
@ -350,7 +350,7 @@ pub async fn get_cleanup_preview(
for doc in low_confidence_docs { for doc in low_confidence_docs {
total_size += doc.file_size; total_size += doc.file_size;
cleanup_candidates.push(serde_json::json!({ cleanup_candidates.push(serde_json::json!({
"id": doc.id, "id": doc.id.to_string(),
"filename": doc.original_filename, "filename": doc.original_filename,
"file_size": doc.file_size, "file_size": doc.file_size,
"ocr_confidence": doc.ocr_confidence, "ocr_confidence": doc.ocr_confidence,
@ -378,7 +378,7 @@ pub async fn get_cleanup_preview(
for doc in failed_docs { for doc in failed_docs {
total_size += doc.file_size; total_size += doc.file_size;
cleanup_candidates.push(serde_json::json!({ cleanup_candidates.push(serde_json::json!({
"id": doc.id, "id": doc.id.to_string(),
"filename": doc.original_filename, "filename": doc.original_filename,
"file_size": doc.file_size, "file_size": doc.file_size,
"ocr_status": doc.ocr_status, "ocr_status": doc.ocr_status,

View File

@ -333,7 +333,7 @@ pub async fn get_document_retry_history(
let history_items: Vec<serde_json::Value> = history.into_iter() let history_items: Vec<serde_json::Value> = history.into_iter()
.map(|h| { .map(|h| {
serde_json::json!({ serde_json::json!({
"id": h.id, "id": h.id.to_string(),
"retry_reason": h.retry_reason, "retry_reason": h.retry_reason,
"previous_status": h.previous_status, "previous_status": h.previous_status,
"previous_failure_reason": h.previous_failure_reason, "previous_failure_reason": h.previous_failure_reason,
@ -346,7 +346,7 @@ pub async fn get_document_retry_history(
.collect(); .collect();
Ok(Json(serde_json::json!({ Ok(Json(serde_json::json!({
"document_id": document_id, "document_id": document_id.to_string(),
"retry_history": history_items, "retry_history": history_items,
"total_retries": history_items.len(), "total_retries": history_items.len(),
}))) })))

View File

@ -221,11 +221,11 @@ mod document_routes_deletion_tests {
"deleted_count": 2, "deleted_count": 2,
"deleted_documents": [ "deleted_documents": [
{ {
"id": doc1.id, "id": doc1.id.to_string(),
"filename": doc1.filename "filename": doc1.filename
}, },
{ {
"id": doc2.id, "id": doc2.id.to_string(),
"filename": doc2.filename "filename": doc2.filename
} }
] ]
@ -244,7 +244,7 @@ mod document_routes_deletion_tests {
"requested_count": 2, "requested_count": 2,
"deleted_documents": [ "deleted_documents": [
{ {
"id": doc1.id, "id": doc1.id.to_string(),
"filename": doc1.filename "filename": doc1.filename
} }
] ]

View File

@ -137,7 +137,7 @@ mod tests {
// Test that OCR response fields match expected structure // Test that OCR response fields match expected structure
let ocr_response = serde_json::json!({ let ocr_response = serde_json::json!({
"document_id": document.id, "id": document.id.to_string(),
"filename": document.filename, "filename": document.filename,
"has_ocr_text": document.ocr_text.is_some(), "has_ocr_text": document.ocr_text.is_some(),
"ocr_text": document.ocr_text, "ocr_text": document.ocr_text,