mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-30 00:34:26 +01:00
add test set/reset distinct attribute
This commit is contained in:
parent
ec230c2835
commit
1746132c7d
23
meilisearch-http/tests/settings/distinct.rs
Normal file
23
meilisearch-http/tests/settings/distinct.rs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
use crate::common::Server;
|
||||||
|
use serde_json::{json, Value};
|
||||||
|
|
||||||
|
#[actix_rt::test]
|
||||||
|
async fn set_and_reset_distinct_attribute() {
|
||||||
|
let server = Server::new().await;
|
||||||
|
let index = server.index("test");
|
||||||
|
|
||||||
|
let (_response, _code) = index.update_settings(json!({ "distinctAttribute": "test"})).await;
|
||||||
|
index.wait_update_id(0).await;
|
||||||
|
|
||||||
|
let (response, _) = index.settings().await;
|
||||||
|
|
||||||
|
assert_eq!(response["distinctAttribute"], "test");
|
||||||
|
|
||||||
|
index.update_settings(json!({ "distinctAttribute": Value::Null })).await;
|
||||||
|
|
||||||
|
index.wait_update_id(1).await;
|
||||||
|
|
||||||
|
let (response, _) = index.settings().await;
|
||||||
|
|
||||||
|
assert_eq!(response["distinctAttribute"], Value::Null);
|
||||||
|
}
|
@ -20,6 +20,7 @@ async fn get_settings() {
|
|||||||
assert_eq!(settings["displayedAttributes"], json!(["*"]));
|
assert_eq!(settings["displayedAttributes"], json!(["*"]));
|
||||||
assert_eq!(settings["searchableAttributes"], json!(["*"]));
|
assert_eq!(settings["searchableAttributes"], json!(["*"]));
|
||||||
assert_eq!(settings["attributesForFaceting"], json!({}));
|
assert_eq!(settings["attributesForFaceting"], json!({}));
|
||||||
|
assert_eq!(settings["distinctAttribute"], serde_json::Value::Null);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
settings["rankingRules"],
|
settings["rankingRules"],
|
||||||
json!([
|
json!([
|
||||||
|
@ -1 +1,2 @@
|
|||||||
mod get_settings;
|
mod get_settings;
|
||||||
|
mod distinct;
|
||||||
|
Loading…
Reference in New Issue
Block a user