Fix test to use new common Value type

This commit is contained in:
Clément Renault 2023-10-12 17:00:08 +02:00
parent f343ef5f2f
commit 1a7f1282af
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F

View File

@ -1,8 +1,8 @@
use meili_snap::snapshot; use meili_snap::snapshot;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use serde_json::{json, Value};
use crate::common::Server; use crate::common::{Server, Value};
use crate::json;
pub(self) static DOCUMENTS: Lazy<Value> = Lazy::new(|| { pub(self) static DOCUMENTS: Lazy<Value> = Lazy::new(|| {
json!([ json!([
@ -33,7 +33,7 @@ async fn distinct_search_with_offset_no_ranking() {
index.update_distinct_attribute(json!(DOCUMENT_DISTINCT_KEY)).await; index.update_distinct_attribute(json!(DOCUMENT_DISTINCT_KEY)).await;
index.wait_task(1).await; index.wait_task(1).await;
fn get_hits(response: Value) -> Vec<i64> { fn get_hits(Value(response): Value) -> Vec<i64> {
let hits_array = response["hits"].as_array().unwrap(); let hits_array = response["hits"].as_array().unwrap();
hits_array.iter().map(|h| h[DOCUMENT_DISTINCT_KEY].as_i64().unwrap()).collect::<Vec<_>>() hits_array.iter().map(|h| h[DOCUMENT_DISTINCT_KEY].as_i64().unwrap()).collect::<Vec<_>>()
} }