mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-25 19:45:05 +08:00
Add test for > 512 byte ID
This commit is contained in:
parent
51bc7b3173
commit
4a922a176f
@ -125,11 +125,11 @@ async fn create_index_with_primary_key() {
|
|||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn create_index_with_invalid_primary_key() {
|
async fn create_index_with_invalid_primary_key() {
|
||||||
let document = json!([ { "id": 2, "title": "Pride and Prejudice" } ]);
|
let documents = json!([ { "id": 2, "title": "Pride and Prejudice" } ]);
|
||||||
|
|
||||||
let server = Server::new().await;
|
let server = Server::new().await;
|
||||||
let index = server.index("movies");
|
let index = server.index("movies");
|
||||||
let (_response, code) = index.add_documents(document, Some("title")).await;
|
let (_response, code) = index.add_documents(documents, Some("title")).await;
|
||||||
assert_eq!(code, 202);
|
assert_eq!(code, 202);
|
||||||
|
|
||||||
index.wait_task(0).await;
|
index.wait_task(0).await;
|
||||||
@ -137,6 +137,17 @@ async fn create_index_with_invalid_primary_key() {
|
|||||||
let (response, code) = index.get().await;
|
let (response, code) = index.get().await;
|
||||||
assert_eq!(code, 200);
|
assert_eq!(code, 200);
|
||||||
assert_eq!(response["primaryKey"], json!(null));
|
assert_eq!(response["primaryKey"], json!(null));
|
||||||
|
|
||||||
|
let documents = json!([ { "id": "e".repeat(513) } ]);
|
||||||
|
|
||||||
|
let (_response, code) = index.add_documents(documents, Some("id")).await;
|
||||||
|
assert_eq!(code, 202);
|
||||||
|
|
||||||
|
index.wait_task(1).await;
|
||||||
|
|
||||||
|
let (response, code) = index.get().await;
|
||||||
|
assert_eq!(code, 200);
|
||||||
|
assert_eq!(response["primaryKey"], json!(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
|
Loading…
Reference in New Issue
Block a user