From 17e00b297acc625e5dd66678374c3528f8b92eb1 Mon Sep 17 00:00:00 2001 From: OMGeeky Date: Tue, 6 Jun 2023 18:42:46 +0200 Subject: [PATCH] add test for upsert --- tests/tests.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/tests.rs b/tests/tests.rs index 04c23e8..9708433 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -216,6 +216,31 @@ async fn test_select_limit_1() { assert_eq!(q.len(), 1); } +#[tokio::test] +async fn test_upsert() { + init_logger(); + let client = get_test_client().await; + let mut local = DbInfos { + client: client.clone(), + row_id: 1923, + info1: None, + info2: None, + info3: None, + info4i: None, + info4b: None, + }; + local.upsert().await.expect("could not perform upsert!"); + DbInfos::delete() + .with_client(client) + .set_data(local) + .build_query() + .expect("could not build delete") + .run() + .await + .expect("could not run delete") + .expect_without_data("delete should not return any data"); +} + #[test] fn test_empty_client() { let empty_client = BigqueryClient::empty();