test reset attributes to wildcard

This commit is contained in:
mpostma 2020-07-15 18:51:36 +02:00
parent 36b763b84e
commit de4caef468
2 changed files with 15 additions and 0 deletions

View File

@ -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 => (),

View File

@ -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], "*");
}