From de4caef4686487fe48cca3d170188c1c07a74089 Mon Sep 17 00:00:00 2001 From: mpostma Date: Wed, 15 Jul 2020 18:51:36 +0200 Subject: [PATCH] test reset attributes to wildcard --- meilisearch-core/src/update/settings_update.rs | 1 + meilisearch-http/tests/settings.rs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/meilisearch-core/src/update/settings_update.rs b/meilisearch-core/src/update/settings_update.rs index 1c8af3be3..71e473ca2 100644 --- a/meilisearch-core/src/update/settings_update.rs +++ b/meilisearch-core/src/update/settings_update.rs @@ -93,6 +93,7 @@ pub fn apply_settings_update( } }, UpdateState::Clear => { + println!("\n\n\n\nHERRE\n\n\n"); schema.set_all_fields_as_displayed(); }, UpdateState::Nothing => (), diff --git a/meilisearch-http/tests/settings.rs b/meilisearch-http/tests/settings.rs index 8b27f54aa..5b24156ea 100644 --- a/meilisearch-http/tests/settings.rs +++ b/meilisearch-http/tests/settings.rs @@ -420,3 +420,17 @@ async fn setting_ranking_rules_dont_mess_with_other_settings() { 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")); } + +#[actix_rt::test] +async fn displayed_and_searchable_attributes_reset_to_wildcard() { + let mut server = common::Server::test_server().await; + server.update_all_settings(json!({ "searchableAttributes": ["color"], "displayedAttributes": ["color"] })).await; + let (response, _) = server.get_all_settings().await; + assert_eq!(response["searchableAttributes"].as_array().unwrap()[0], "color"); + assert_eq!(response["displayedAttributes"].as_array().unwrap()[0], "color"); + server.delete_searchable_attributes().await; + server.delete_displayed_attributes().await; + let (response, _) = server.get_all_settings().await; + assert_eq!(response["searchableAttributes"].as_array().unwrap()[0], "*"); + assert_eq!(response["displayedAttributes"].as_array().unwrap()[0], "*"); +}