fix various bugs

This commit is contained in:
mpostma 2021-03-12 00:37:43 +01:00
parent 7d9637861f
commit e4d45b0500
No known key found for this signature in database
GPG key ID: CBC8A7C1D7A28C3A
7 changed files with 27 additions and 65 deletions

View file

@ -70,5 +70,5 @@ async fn test_create_multiple_indexes() {
assert_eq!(index1.get().await.1, 200);
assert_eq!(index2.get().await.1, 200);
assert_eq!(index3.get().await.1, 200);
assert_eq!(index4.get().await.1, 400);
assert_eq!(index4.get().await.1, 404);
}

View file

@ -6,13 +6,17 @@ async fn create_and_delete_index() {
let index = server.index("test");
let (_response, code) = index.create(None).await;
println!("response: {}", _response);
assert_eq!(code, 200);
let (_response, code) = index.delete().await;
println!("response: {}", _response);
assert_eq!(code, 200);
assert_eq!(index.get().await.1, 400);
assert_eq!(index.get().await.1, 404);
}
#[actix_rt::test]

View file

@ -13,12 +13,11 @@ async fn create_and_get_index() {
assert_eq!(code, 200);
assert_eq!(response["uid"], "test");
assert!(response.get("uuid").is_some());
assert!(response.get("createdAt").is_some());
assert!(response.get("updatedAt").is_some());
assert_eq!(response["createdAt"], response["updatedAt"]);
assert_eq!(response["primaryKey"], Value::Null);
assert_eq!(response.as_object().unwrap().len(), 5);
assert_eq!(response.as_object().unwrap().len(), 4);
}
// TODO: partial test since we are testing error, amd error is not yet fully implemented in
@ -30,7 +29,7 @@ async fn get_unexisting_index() {
let (_response, code) = index.get().await;
assert_eq!(code, 400);
assert_eq!(code, 404);
}
#[actix_rt::test]
@ -55,5 +54,4 @@ async fn list_multiple_indexes() {
assert_eq!(arr.len(), 2);
assert!(arr.iter().find(|entry| entry["uid"] == "test" && entry["primaryKey"] == Value::Null).is_some());
assert!(arr.iter().find(|entry| entry["uid"] == "test1" && entry["primaryKey"] == "key").is_some());
}