fix tests

This commit is contained in:
mpostma 2020-12-15 12:05:17 +01:00
parent 2904ca7f57
commit 6eb7843858
5 changed files with 28 additions and 69 deletions

View File

@ -1,2 +1,3 @@
{"status": "processed","updateId": 0,"type": {"name":"Settings","settings":{"ranking_rules":{"Update":["Typo","Words","Proximity","Attribute","WordsPosition","Exactness"]},"distinct_attribute":"Nothing","primary_key":"Nothing","searchable_attributes":{"Update":["balance","picture","age","color","name","gender","email","phone","address","about","registered","latitude","longitude","tags"]},"displayed_attributes":{"Update":["about","address","age","balance","color","email","gender","id","isActive","latitude","longitude","name","phone","picture","registered","tags"]},"stop_words":"Nothing","synonyms":"Nothing","attributes_for_faceting":"Nothing"}}}
{"status": "processed", "updateId": 1, "type": { "name": "DocumentsAddition"}}
{"status":"processed","updateId":0,"type":{"name":"Settings","settings":{"ranking_rules":{"Update":["Typo","Words","Proximity","Attribute","WordsPosition","Exactness"]},"distinct_attribute":"Nothing","primary_key":"Nothing","searchable_attributes":"Nothing","displayed_attributes":"Nothing","stop_words":"Nothing","synonyms":"Nothing","attributes_for_faceting":"Nothing"}}}
{"status":"processed","updateId":1,"type":{"name":"DocumentsAddition","number":77}}

View File

@ -88,40 +88,6 @@ impl Server {
"wordsPosition",
"exactness",
],
"searchableAttributes": [
"balance",
"picture",
"age",
"color",
"name",
"gender",
"email",
"phone",
"address",
"about",
"registered",
"latitude",
"longitude",
"tags",
],
"displayedAttributes": [
"id",
"isActive",
"balance",
"picture",
"age",
"color",
"name",
"gender",
"email",
"phone",
"address",
"about",
"registered",
"latitude",
"longitude",
"tags",
],
});
server.update_all_settings(body).await;

View File

@ -132,6 +132,8 @@ async fn get_dump_status_should_return_done() {
let (value, status_code) = server.trigger_dump().await;
println!("value: {:#?}", value);
assert_eq!(status_code, 202);
let dump_uid = value["uid"].as_str().unwrap().to_string();
@ -367,20 +369,10 @@ async fn dump_index_updates_should_be_valid() {
compression::from_tar_gz(&dumps_dir.join(&format!("{}.dump", uid)), tmp_dir_path).unwrap();
let file = File::open(tmp_dir_path.join("test").join("updates.jsonl")).unwrap();
let mut updates = read_all_jsonline(file);
let updates = read_all_jsonline(file);
// hotfix until #943 is fixed (https://github.com/meilisearch/MeiliSearch/issues/943)
updates.as_array_mut().unwrap()
.get_mut(0).unwrap()
.get_mut("type").unwrap()
.get_mut("settings").unwrap()
.get_mut("displayed_attributes").unwrap()
.get_mut("Update").unwrap()
.as_array_mut().unwrap().sort_by(|a, b| a.as_str().cmp(&b.as_str()));
eprintln!("{}\n", updates.to_string());
eprintln!("{}", expected.to_string());
eprintln!("{}\n", updates);
eprintln!("{}", expected);
assert_json_include!(expected: expected, actual: updates);
}

View File

@ -779,30 +779,32 @@ async fn update_existing_primary_key_is_error() {
}
#[actix_rt::test]
async fn test_facets_distribution_attribute() {
async fn test_field_distribution_attribute() {
let mut server = common::Server::test_server().await;
let (response, _status_code) = server.get_index_stats().await;
let expected = json!({
"isIndexing": false,
"numberOfDocuments":77,
"fieldsDistribution":{
"age":77,
"gender":77,
"phone":77,
"name":77,
"registered":77,
"latitude":77,
"email":77,
"tags":77,
"longitude":77,
"color":77,
"address":77,
"balance":77,
"about":77,
"picture":77,
"fieldsDistribution": {
"about": 77,
"address": 77,
"age": 77,
"balance": 77,
"color": 77,
"email": 77,
"gender": 77,
"id": 77,
"isActive": 77,
"latitude": 77,
"longitude": 77,
"name": 77,
"phone": 77,
"picture": 77,
"registered": 77,
"tags": 77
},
"isIndexing": false,
"numberOfDocuments": 77
});
assert_json_eq!(expected, response, ordered: true);

View File

@ -1789,8 +1789,6 @@ async fn update_documents_with_facet_distribution() {
server.create_index(body).await;
let settings = json!({
"attributesForFaceting": ["genre"],
"displayedAttributes": ["genre"],
"searchableAttributes": ["genre"]
});
server.update_all_settings(settings).await;
let update1 = json!([