Skip to content

Commit

Permalink
fix the test
Browse files Browse the repository at this point in the history
  • Loading branch information
irevoire committed Apr 15, 2024
1 parent 19a67f6 commit 83d06ed
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/indexes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2063,21 +2063,31 @@ mod tests {

#[meilisearch_test]
async fn test_update_document_json(client: Client, index: Index) -> Result<(), Error> {
let old_json = r#"{ "id": 1, "body": "doggo" }{ "id": 2, "body": "catto" }"#.as_bytes();
let updated_json = r#"{ "id": 1, "second_body": "second_doggo" }{ "id": 2, "second_body": "second_catto" }"#.as_bytes();
let old_json = [
json!({ "id": 1, "body": "doggo" }),
json!({ "id": 2, "body": "catto" }),
];
let updated_json = [
json!({ "id": 1, "second_body": "second_doggo" }),
json!({ "id": 2, "second_body": "second_catto" }),
];

let task = index
.add_documents(old_json, Some("id"))
.await?
.add_documents(&old_json, Some("id"))
.await
.unwrap()
.wait_for_completion(&client, None, None)
.await?;
.await
.unwrap();
let _ = index.get_task(task).await?;

let task = index
.add_or_update(updated_json, None)
.await?
.add_or_update(&updated_json, None)
.await
.unwrap()
.wait_for_completion(&client, None, None)
.await?;
.await
.unwrap();

let status = index.get_task(task).await?;
let elements = index.get_documents::<serde_json::Value>().await.unwrap();
Expand Down

0 comments on commit 83d06ed

Please sign in to comment.