30 lines
865 B
Rust
30 lines
865 B
Rust
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());
|
|
}
|