Initial commit: Full Crawl API implementation
This commit is contained in:
29
crates/api/tests/integration_test.rs
Normal file
29
crates/api/tests/integration_test.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
use serde_json::json;
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_health_check() {
|
||||
// This is a placeholder for integration tests
|
||||
// In a real setup, you would spawn the API server and make HTTP requests
|
||||
assert!(true);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_crawl_request_validation() {
|
||||
let req = shared::models::CrawlRequest {
|
||||
url: "https://example.com".to_string(),
|
||||
options: shared::models::CrawlOptions::default(),
|
||||
};
|
||||
assert_eq!(req.url, "https://example.com");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_api_response_format() {
|
||||
let response = shared::api::ApiResponse::ok(json!({"test": true}));
|
||||
assert!(response.success);
|
||||
assert!(response.data.is_some());
|
||||
assert!(response.error.is_none());
|
||||
|
||||
let error = shared::api::ApiResponse::<()>::err("Something went wrong");
|
||||
assert!(!error.success);
|
||||
assert!(error.error.is_some());
|
||||
}
|
||||
Reference in New Issue
Block a user