test partial update

This commit is contained in:
mpostma 2021-02-24 09:42:36 +01:00
parent c7ab4dccc3
commit 7d9c5f64aa
No known key found for this signature in database
GPG Key ID: CBC8A7C1D7A28C3A

View File

@ -22,6 +22,34 @@ async fn get_settings() {
assert_eq!(settings["facetedAttributes"], json!({}));
}
#[actix_rt::test]
async fn update_settings_unknown_field() {
let server = Server::new().await;
let index = server.index("test");
let (_response, code) = index.update_settings(json!({"foo": 12})).await;
assert_eq!(code, 400);
}
#[actix_rt::test]
async fn test_partial_update() {
let server = Server::new().await;
let index = server.index("test");
index.update_settings(json!({"displayedAttributes": ["foo"]})).await;
index.wait_update_id(0).await;
let (response, code) = index.settings().await;
assert_eq!(code, 200);
assert_eq!(response["displayedAttributes"],json!(["foo"]));
assert_eq!(response["searchableAttributes"],json!(["*"]));
index.update_settings(json!({"searchableAttributes": ["bar"]})).await;
index.wait_update_id(1).await;
let (response, code) = index.settings().await;
assert_eq!(code, 200);
assert_eq!(response["displayedAttributes"],json!(["foo"]));
assert_eq!(response["searchableAttributes"],json!(["bar"]));
}
#[actix_rt::test]
async fn update_setting_unexisting_index() {
let server = Server::new().await;