mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 12:05:05 +08:00
Use snapshot instead of asserts
Co-authored-by: Many the fish <many@meilisearch.com>
This commit is contained in:
parent
0e2a5951b4
commit
59201a7852
@ -1,3 +1,4 @@
|
|||||||
|
use meili_snap::snapshot;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use serde_json::{json, Value};
|
use serde_json::{json, Value};
|
||||||
|
|
||||||
@ -70,14 +71,14 @@ async fn advanced_facet_search() {
|
|||||||
let (response, code) =
|
let (response, code) =
|
||||||
index.facet_search(json!({"facetName": "genres", "facetQuery": "adventre"})).await;
|
index.facet_search(json!({"facetName": "genres", "facetQuery": "adventre"})).await;
|
||||||
|
|
||||||
assert_eq!(code, 200, "{}", response);
|
snapshot!(code, @"200 OK");
|
||||||
assert_eq!(dbg!(response)["facetHits"].as_array().unwrap().len(), 0);
|
snapshot!(response["facetHits"].as_array().unwrap().len(), @"0");
|
||||||
|
|
||||||
let (response, code) =
|
let (response, code) =
|
||||||
index.facet_search(json!({"facetName": "genres", "facetQuery": "àdventure"})).await;
|
index.facet_search(json!({"facetName": "genres", "facetQuery": "àdventure"})).await;
|
||||||
|
|
||||||
assert_eq!(code, 200, "{}", response);
|
snapshot!(code, @"200 OK");
|
||||||
assert_eq!(response["facetHits"].as_array().unwrap().len(), 1);
|
snapshot!(response["facetHits"].as_array().unwrap().len(), @"1");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
@ -94,14 +95,14 @@ async fn more_advanced_facet_search() {
|
|||||||
let (response, code) =
|
let (response, code) =
|
||||||
index.facet_search(json!({"facetName": "genres", "facetQuery": "adventre"})).await;
|
index.facet_search(json!({"facetName": "genres", "facetQuery": "adventre"})).await;
|
||||||
|
|
||||||
assert_eq!(code, 200, "{}", response);
|
snapshot!(code, @"200 OK");
|
||||||
assert_eq!(dbg!(response)["facetHits"].as_array().unwrap().len(), 0);
|
snapshot!(response["facetHits"].as_array().unwrap().len(), @"0");
|
||||||
|
|
||||||
let (response, code) =
|
let (response, code) =
|
||||||
index.facet_search(json!({"facetName": "genres", "facetQuery": "adventure"})).await;
|
index.facet_search(json!({"facetName": "genres", "facetQuery": "adventure"})).await;
|
||||||
|
|
||||||
assert_eq!(code, 200, "{}", response);
|
snapshot!(code, @"200 OK");
|
||||||
assert_eq!(response["facetHits"].as_array().unwrap().len(), 1);
|
snapshot!(response["facetHits"].as_array().unwrap().len(), @"1");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
|
Loading…
Reference in New Issue
Block a user