mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 23:04:26 +01:00
tests get one document
This commit is contained in:
parent
097cae90a7
commit
ded6483173
@ -13,6 +13,41 @@ async fn get_unexisting_index_single_document() {
|
|||||||
assert_eq!(code, 400);
|
assert_eq!(code, 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[actix_rt::test]
|
||||||
|
async fn get_unexisting_document() {
|
||||||
|
let server = Server::new().await;
|
||||||
|
let index = server.index("test");
|
||||||
|
index.create(None).await;
|
||||||
|
let (_response, code) = index
|
||||||
|
.get_document(1, None)
|
||||||
|
.await;
|
||||||
|
assert_eq!(code, 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[actix_rt::test]
|
||||||
|
async fn get_document() {
|
||||||
|
let server = Server::new().await;
|
||||||
|
let index = server.index("test");
|
||||||
|
index.create(None).await;
|
||||||
|
let documents = serde_json::json!([
|
||||||
|
{
|
||||||
|
"id": 0,
|
||||||
|
"content": "foobar",
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
let (_, code) = index.add_documents(documents, None).await;
|
||||||
|
assert_eq!(code, 200);
|
||||||
|
index.wait_update_id(0).await;
|
||||||
|
let (response, code) = index
|
||||||
|
.get_document(0, None)
|
||||||
|
.await;
|
||||||
|
assert_eq!(code, 200);
|
||||||
|
assert_eq!(response, serde_json::json!( {
|
||||||
|
"id": 0,
|
||||||
|
"content": "foobar",
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn get_unexisting_index_all_documents() {
|
async fn get_unexisting_index_all_documents() {
|
||||||
let server = Server::new().await;
|
let server = Server::new().await;
|
||||||
|
Loading…
Reference in New Issue
Block a user