Improve Integration tests in the file stats.rs

This commit is contained in:
Santhosh Reddy Vootukuri (SUNNY) (from Dev Box) 2024-08-08 07:31:46 -07:00
parent 321639364f
commit fdfb7c28c8

View File

@ -3,13 +3,13 @@ use crate::json;
#[actix_rt::test] #[actix_rt::test]
async fn stats() { async fn stats() {
let server = Server::new().await; let server = Server::new_shared().await;
let index = server.index("test"); let index = server.unique_index();
let (_, code) = index.create(Some("id")).await; let (task, code) = index.create(Some("id")).await;
assert_eq!(code, 202); assert_eq!(code, 202);
index.wait_task(0).await; index.wait_task(task.uid()).await.succeeded();
let (response, code) = index.stats().await; let (response, code) = index.stats().await;
@ -33,7 +33,7 @@ async fn stats() {
assert_eq!(code, 202); assert_eq!(code, 202);
assert_eq!(response["taskUid"], 1); assert_eq!(response["taskUid"], 1);
index.wait_task(1).await; index.wait_task(response.uid()).await.succeeded();
let (response, code) = index.stats().await; let (response, code) = index.stats().await;
@ -47,8 +47,8 @@ async fn stats() {
#[actix_rt::test] #[actix_rt::test]
async fn error_get_stats_unexisting_index() { async fn error_get_stats_unexisting_index() {
let server = Server::new().await; let server = Server::new_shared().await;
let (response, code) = server.index("test").stats().await; let (response, code) = server.unique_index().stats().await;
let expected_response = json!({ let expected_response = json!({
"message": "Index `test` not found.", "message": "Index `test` not found.",