From 22e196d554c826415b3128d8c315e3c828b2c90d Mon Sep 17 00:00:00 2001 From: perf3ct Date: Wed, 9 Jul 2025 20:10:36 +0000 Subject: [PATCH] fix(tests): resolve integration test response format --- src/routes/documents/bulk.rs | 6 +++--- src/routes/documents_ocr_retry.rs | 4 ++-- tests/integration_document_routes_tests.rs | 6 +++--- tests/integration_documents_database_tests.rs | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/routes/documents/bulk.rs b/src/routes/documents/bulk.rs index b5d9c2a..c58e05e 100644 --- a/src/routes/documents/bulk.rs +++ b/src/routes/documents/bulk.rs @@ -159,7 +159,7 @@ pub async fn delete_low_confidence_documents( .iter() .take(10) // Show max 10 in preview .map(|doc| serde_json::json!({ - "id": doc.id, + "id": doc.id.to_string(), "filename": doc.original_filename, "ocr_confidence": doc.ocr_confidence, "created_at": doc.created_at @@ -350,7 +350,7 @@ pub async fn get_cleanup_preview( for doc in low_confidence_docs { total_size += doc.file_size; cleanup_candidates.push(serde_json::json!({ - "id": doc.id, + "id": doc.id.to_string(), "filename": doc.original_filename, "file_size": doc.file_size, "ocr_confidence": doc.ocr_confidence, @@ -378,7 +378,7 @@ pub async fn get_cleanup_preview( for doc in failed_docs { total_size += doc.file_size; cleanup_candidates.push(serde_json::json!({ - "id": doc.id, + "id": doc.id.to_string(), "filename": doc.original_filename, "file_size": doc.file_size, "ocr_status": doc.ocr_status, diff --git a/src/routes/documents_ocr_retry.rs b/src/routes/documents_ocr_retry.rs index 7e11b83..6209f9f 100644 --- a/src/routes/documents_ocr_retry.rs +++ b/src/routes/documents_ocr_retry.rs @@ -333,7 +333,7 @@ pub async fn get_document_retry_history( let history_items: Vec = history.into_iter() .map(|h| { serde_json::json!({ - "id": h.id, + "id": h.id.to_string(), "retry_reason": h.retry_reason, "previous_status": h.previous_status, "previous_failure_reason": h.previous_failure_reason, @@ -346,7 +346,7 @@ pub async fn get_document_retry_history( .collect(); Ok(Json(serde_json::json!({ - "document_id": document_id, + "document_id": document_id.to_string(), "retry_history": history_items, "total_retries": history_items.len(), }))) diff --git a/tests/integration_document_routes_tests.rs b/tests/integration_document_routes_tests.rs index ea70838..fbf0c19 100644 --- a/tests/integration_document_routes_tests.rs +++ b/tests/integration_document_routes_tests.rs @@ -221,11 +221,11 @@ mod document_routes_deletion_tests { "deleted_count": 2, "deleted_documents": [ { - "id": doc1.id, + "id": doc1.id.to_string(), "filename": doc1.filename }, { - "id": doc2.id, + "id": doc2.id.to_string(), "filename": doc2.filename } ] @@ -244,7 +244,7 @@ mod document_routes_deletion_tests { "requested_count": 2, "deleted_documents": [ { - "id": doc1.id, + "id": doc1.id.to_string(), "filename": doc1.filename } ] diff --git a/tests/integration_documents_database_tests.rs b/tests/integration_documents_database_tests.rs index 440a485..5c7343a 100644 --- a/tests/integration_documents_database_tests.rs +++ b/tests/integration_documents_database_tests.rs @@ -137,7 +137,7 @@ mod tests { // Test that OCR response fields match expected structure let ocr_response = serde_json::json!({ - "document_id": document.id, + "id": document.id.to_string(), "filename": document.filename, "has_ocr_text": document.ocr_text.is_some(), "ocr_text": document.ocr_text,