From 60a90e96f323370ca818c6f824668509e843635e Mon Sep 17 00:00:00 2001 From: mpostma Date: Tue, 16 Jun 2020 09:52:58 +0200 Subject: [PATCH] add test for ranking rules settings --- meilisearch-http/tests/settings.rs | 14 ++++++++++++++ meilisearch-http/tests/settings_ranking_rules.rs | 1 - 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/meilisearch-http/tests/settings.rs b/meilisearch-http/tests/settings.rs index dcbe5760f..5716860b9 100644 --- a/meilisearch-http/tests/settings.rs +++ b/meilisearch-http/tests/settings.rs @@ -455,3 +455,17 @@ async fn attributes_for_faceting_settings() { let (response, _status_code) = server.get_request("/indexes/test/settings/attributes-for-faceting").await; assert_eq!(response, json!([])); } + +#[actix_rt::test] +async fn setting_ranking_rules_dont_mess_with_other_settings() { + let mut server = common::Server::test_server().await; + let body = json!({ + "rankingRules": ["asc(foobar)"] + }); + server.update_all_settings(body).await; + let (response, _) = server.get_all_settings().await; + assert_eq!(response["rankingRules"].as_array().unwrap().len(), 1); + assert_eq!(response["rankingRules"].as_array().unwrap().first().unwrap().as_str().unwrap(), "asc(foobar)"); + assert!(!response["searchableAttributes"].as_array().unwrap().iter().any(|e| e.as_str().unwrap() == "foobar")); + assert!(!response["displayedAttributes"].as_array().unwrap().iter().any(|e| e.as_str().unwrap() == "foobar")); +} diff --git a/meilisearch-http/tests/settings_ranking_rules.rs b/meilisearch-http/tests/settings_ranking_rules.rs index 7dbe9c8ea..67ddcc9ac 100644 --- a/meilisearch-http/tests/settings_ranking_rules.rs +++ b/meilisearch-http/tests/settings_ranking_rules.rs @@ -173,7 +173,6 @@ async fn write_custom_ranking_and_index_documents() { let expected = json!({ "id": 1, - "title": "Le Petit Prince", "author": "Exupéry" });