mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-11 07:28:56 +01:00
test attributes_for_faceting subroutes
This commit is contained in:
parent
ed051b65ad
commit
3fe3c8cf02
@ -120,7 +120,7 @@ async fn write_all_and_delete() {
|
||||
],
|
||||
"stopWords": [],
|
||||
"synonyms": {},
|
||||
"attributesForFaceting": null,
|
||||
"attributesForFaceting": [],
|
||||
"acceptNewFields": true,
|
||||
});
|
||||
|
||||
@ -282,7 +282,7 @@ async fn test_default_settings() {
|
||||
"displayedAttributes": [],
|
||||
"stopWords": [],
|
||||
"synonyms": {},
|
||||
"attributesForFaceting": null,
|
||||
"attributesForFaceting": [],
|
||||
"acceptNewFields": true,
|
||||
});
|
||||
|
||||
@ -320,7 +320,7 @@ async fn test_default_settings_2() {
|
||||
],
|
||||
"stopWords": [],
|
||||
"synonyms": {},
|
||||
"attributesForFaceting": null,
|
||||
"attributesForFaceting": [],
|
||||
"acceptNewFields": true,
|
||||
});
|
||||
|
||||
@ -428,7 +428,7 @@ async fn write_setting_and_update_partial() {
|
||||
"wolverine": ["xmen", "logan"],
|
||||
"logan": ["wolverine"],
|
||||
},
|
||||
"attributesForFaceting": null,
|
||||
"attributesForFaceting": [],
|
||||
"acceptNewFields": false,
|
||||
});
|
||||
|
||||
@ -436,3 +436,22 @@ async fn write_setting_and_update_partial() {
|
||||
|
||||
assert_json_eq!(expected, response, ordered: false);
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn attributes_for_faceting_settings() {
|
||||
let mut server = common::Server::test_server().await;
|
||||
// initial attributes array should be empty
|
||||
let (response, _status_code) = server.get_request("/indexes/test/settings/attributes-for-faceting").await;
|
||||
assert_eq!(response, json!([]));
|
||||
// add an attribute and test for its presence
|
||||
let (_response, _status_code) = server.post_request_async(
|
||||
"/indexes/test/settings/attributes-for-faceting",
|
||||
json!(["foobar"])).await;
|
||||
let (response, _status_code) = server.get_request("/indexes/test/settings/attributes-for-faceting").await;
|
||||
assert_eq!(response, json!(["foobar"]));
|
||||
// remove all attributes and test for emptiness
|
||||
let (_response, _status_code) = server.delete_request_async(
|
||||
"/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!([]));
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ async fn accept_new_fields_does_not_take_into_account_the_primary_key() {
|
||||
"displayedAttributes": ["title"],
|
||||
"stopWords": [],
|
||||
"synonyms": {},
|
||||
"attributesForFaceting": null,
|
||||
"attributesForFaceting": [],
|
||||
"acceptNewFields": false,
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user