Fix PR comments

This commit is contained in:
many 2021-11-04 13:38:44 +01:00
parent b664a46e91
commit b59145385e
No known key found for this signature in database
GPG key ID: 2CEF23B75189EACA
3 changed files with 103 additions and 7 deletions

View file

@ -997,3 +997,32 @@ async fn error_add_documents_payload_size() {
assert_eq!(response, expected_response);
assert_eq!(code, 413);
}
#[actix_rt::test]
async fn error_primary_key_inference() {
let server = Server::new().await;
let index = server.index("test");
let documents = json!([
{
"title": "11",
"desc": "foobar"
}
]);
index.add_documents(documents, None).await;
index.wait_update_id(0).await;
let (response, code) = index.get_update(0).await;
assert_eq!(code, 200);
assert_eq!(response["status"], "failed");
assert_eq!(
response["message"],
r#"The primary key inference process failed because the engine did not find any fields containing `id` substring in their name. If your document identifier does not contain any `id` substring, you can set the primary key of the index."#
);
assert_eq!(response["code"], "primary_key_inference_failed");
assert_eq!(response["type"], "invalid_request");
assert_eq!(
response["link"],
"https://docs.meilisearch.com/errors#primary_key_inference_failed"
);
}