@@ -2063,21 +2063,31 @@ mod tests {
2063
2063
2064
2064
#[ meilisearch_test]
2065
2065
async fn test_update_document_json ( client : Client , index : Index ) -> Result < ( ) , Error > {
2066
- let old_json = r#"{ "id": 1, "body": "doggo" }{ "id": 2, "body": "catto" }"# . as_bytes ( ) ;
2067
- let updated_json = r#"{ "id": 1, "second_body": "second_doggo" }{ "id": 2, "second_body": "second_catto" }"# . as_bytes ( ) ;
2066
+ let old_json = [
2067
+ json ! ( { "id" : 1 , "body" : "doggo" } ) ,
2068
+ json ! ( { "id" : 2 , "body" : "catto" } ) ,
2069
+ ] ;
2070
+ let updated_json = [
2071
+ json ! ( { "id" : 1 , "second_body" : "second_doggo" } ) ,
2072
+ json ! ( { "id" : 2 , "second_body" : "second_catto" } ) ,
2073
+ ] ;
2068
2074
2069
2075
let task = index
2070
- . add_documents ( old_json, Some ( "id" ) )
2071
- . await ?
2076
+ . add_documents ( & old_json, Some ( "id" ) )
2077
+ . await
2078
+ . unwrap ( )
2072
2079
. wait_for_completion ( & client, None , None )
2073
- . await ?;
2080
+ . await
2081
+ . unwrap ( ) ;
2074
2082
let _ = index. get_task ( task) . await ?;
2075
2083
2076
2084
let task = index
2077
- . add_or_update ( updated_json, None )
2078
- . await ?
2085
+ . add_or_update ( & updated_json, None )
2086
+ . await
2087
+ . unwrap ( )
2079
2088
. wait_for_completion ( & client, None , None )
2080
- . await ?;
2089
+ . await
2090
+ . unwrap ( ) ;
2081
2091
2082
2092
let status = index. get_task ( task) . await ?;
2083
2093
let elements = index. get_documents :: < serde_json:: Value > ( ) . await . unwrap ( ) ;
0 commit comments