Change lacking errors

This commit is contained in:
many 2021-11-03 14:25:49 +01:00
parent c32f13a909
commit 30a094cbb2
No known key found for this signature in database
GPG key ID: 2CEF23B75189EACA
14 changed files with 128 additions and 61 deletions

View file

@ -940,25 +940,29 @@ async fn error_document_field_limit_reached() {
}
#[actix_rt::test]
#[ignore] // // TODO: Fix in an other PR: this does not provoke any error.
async fn error_add_documents_invalid_geo_field() {
let server = Server::new().await;
let index = server.index("test");
index.create(Some("id")).await;
index
.update_settings(json!({"sortableAttributes": ["_geo"]}))
.await;
let documents = json!([
{
"id": "11",
"_geo": "foobar"
}
]);
index.add_documents(documents, None).await;
index.wait_update_id(0).await;
let (response, code) = index.get_update(0).await;
index.wait_update_id(1).await;
let (response, code) = index.get_update(1).await;
assert_eq!(code, 200);
assert_eq!(response["status"], "failed");
assert_eq!(
response["message"],
r#"The document with the id: `11` contains an invalid _geo field: :syntaxErrorHelper:REPLACE_ME."#
r#"The document with the id: `11` contains an invalid _geo field: `foobar`."#
);
assert_eq!(response["code"], "invalid_geo_field");
assert_eq!(response["type"], "invalid_request");