From f81b9a8c7b8b3d1b523070c7f16052bf7edaa62d Mon Sep 17 00:00:00 2001 From: Chris Guida Date: Tue, 23 Mar 2021 10:37:20 -0600 Subject: [PATCH] add basic test --- patch-db/src/test.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/patch-db/src/test.rs b/patch-db/src/test.rs index e702e72..79ce572 100644 --- a/patch-db/src/test.rs +++ b/patch-db/src/test.rs @@ -3,10 +3,11 @@ use super::*; #[tokio::test] async fn basic() { let db = PatchDb::open("test.db").await.unwrap(); - let _rev = db - .put(&JsonPointer::<&'static str>::default(), &"test") - .await - .unwrap(); + db.put(&JsonPointer::<&'static str>::default(), &Sample{a: "test1".to_string(), b: Child{a: "test2".to_string(), b: 4} }).await.unwrap(); + let ptr: JsonPointer = "/b/b".parse().unwrap(); + db.put(&ptr, &"hello").await.unwrap(); + let get_res: Value = db.get(&ptr).await.unwrap(); + assert_eq!(get_res, "hello"); } #[derive(Debug, serde::Deserialize, serde::Serialize)]