add test for ranking rules settings

This commit is contained in:
mpostma 2020-06-16 09:52:58 +02:00
parent 6167a10e5e
commit 60a90e96f3
2 changed files with 14 additions and 1 deletions

View File

@ -455,3 +455,17 @@ async fn attributes_for_faceting_settings() {
let (response, _status_code) = server.get_request("/indexes/test/settings/attributes-for-faceting").await; let (response, _status_code) = server.get_request("/indexes/test/settings/attributes-for-faceting").await;
assert_eq!(response, json!([])); 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"));
}

View File

@ -173,7 +173,6 @@ async fn write_custom_ranking_and_index_documents() {
let expected = json!({ let expected = json!({
"id": 1, "id": 1,
"title": "Le Petit Prince",
"author": "Exupéry" "author": "Exupéry"
}); });