add more tests for the stop_words

This commit is contained in:
tamo 2021-04-06 18:29:38 +02:00
parent b1962c8e02
commit dcd60a5b45
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69

View File

@ -78,13 +78,14 @@ async fn reset_all_settings() {
let server = Server::new().await; let server = Server::new().await;
let index = server.index("test"); let index = server.index("test");
index index
.update_settings(json!({"displayedAttributes": ["foo"], "searchableAttributes": ["bar"]})) .update_settings(json!({"displayedAttributes": ["foo"], "searchableAttributes": ["bar"], "stopWords": ["the"] }))
.await; .await;
index.wait_update_id(0).await; index.wait_update_id(0).await;
let (response, code) = index.settings().await; let (response, code) = index.settings().await;
assert_eq!(code, 200); assert_eq!(code, 200);
assert_eq!(response["displayedAttributes"], json!(["foo"])); assert_eq!(response["displayedAttributes"], json!(["foo"]));
assert_eq!(response["searchableAttributes"], json!(["bar"])); assert_eq!(response["searchableAttributes"], json!(["bar"]));
assert_eq!(response["stopWords"], json!(["the"]));
index.delete_settings().await; index.delete_settings().await;
index.wait_update_id(1).await; index.wait_update_id(1).await;
@ -93,6 +94,7 @@ async fn reset_all_settings() {
assert_eq!(code, 200); assert_eq!(code, 200);
assert_eq!(response["displayedAttributes"], json!(["*"])); assert_eq!(response["displayedAttributes"], json!(["*"]));
assert_eq!(response["searchableAttributes"], json!(["*"])); assert_eq!(response["searchableAttributes"], json!(["*"]));
assert_eq!(response["stopWords"], json!([]));
} }
#[actix_rt::test] #[actix_rt::test]
@ -166,5 +168,6 @@ macro_rules! test_setting_routes {
test_setting_routes!( test_setting_routes!(
attributes_for_faceting, attributes_for_faceting,
displayed_attributes, displayed_attributes,
searchable_attributes searchable_attributes,
stop_words
); );