Fix some errors

This commit is contained in:
many 2021-10-26 19:36:48 +02:00
parent 61c15b69fb
commit 7464720426
No known key found for this signature in database
GPG key ID: 2CEF23B75189EACA
27 changed files with 347 additions and 234 deletions

View file

@ -44,14 +44,23 @@ async fn update_nothing() {
async fn error_update_existing_primary_key() {
let server = Server::new().await;
let index = server.index("test");
let (_response, code) = index.create(Some("primary")).await;
let (_response, code) = index.create(Some("id")).await;
assert_eq!(code, 201);
let (response, code) = index.update(Some("primary2")).await;
let documents = json!([
{
"id": "11",
"content": "foobar"
}
]);
index.add_documents(documents, None).await;
index.wait_update_id(0).await;
let (response, code) = index.update(Some("primary")).await;
let expected_response = json!({
"message": "Index test already has a primary key.",
"message": "Index already has a primary key: `id`.",
"code": "index_primary_key_already_exists",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#index_primary_key_already_exists"
@ -67,7 +76,7 @@ async fn error_update_unexisting_index() {
let (response, code) = server.index("test").update(None).await;
let expected_response = json!({
"message": "Index test not found.",
"message": "Index `test` not found.",
"code": "index_not_found",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#index_not_found"