added rust api to control DESI data distribution; updated to utilize bun for renovate
CI / Unit tests (pull_request) Failing after 8m55s
CI / Unit tests (pull_request) Failing after 8m55s
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
use axum::body::{to_bytes, Body};
|
||||
use axum::http::{Request, StatusCode};
|
||||
use tower::ServiceExt;
|
||||
|
||||
use desi_explorer_api::routes;
|
||||
|
||||
#[tokio::test]
|
||||
async fn health_returns_ok() {
|
||||
let app = routes::app();
|
||||
|
||||
let response = app
|
||||
.oneshot(
|
||||
Request::builder()
|
||||
.uri("/health")
|
||||
.body(Body::empty())
|
||||
.unwrap(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(response.status(), StatusCode::OK);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn catalogs_is_nonempty() {
|
||||
let app = routes::app();
|
||||
|
||||
let response = app
|
||||
.oneshot(
|
||||
Request::builder()
|
||||
.uri("/api/v1/catalogs")
|
||||
.body(Body::empty())
|
||||
.unwrap(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(response.status(), StatusCode::OK);
|
||||
|
||||
let body = to_bytes(response.into_body(), usize::MAX).await.unwrap();
|
||||
let json: serde_json::Value = serde_json::from_slice(&body).unwrap();
|
||||
let catalogs = json.as_array().unwrap();
|
||||
assert!(!catalogs.is_empty());
|
||||
}
|
||||
Reference in New Issue
Block a user