From 1f30639c8e288d75bfa8766aa230f3ab6f80281e Mon Sep 17 00:00:00 2001 From: RossanaTat Date: Thu, 29 Feb 2024 12:20:21 -0500 Subject: [PATCH] updating tests --- tests/testthat/test-dplyr-joins.R | 48 ++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-dplyr-joins.R b/tests/testthat/test-dplyr-joins.R index ae795290..8883c590 100644 --- a/tests/testthat/test-dplyr-joins.R +++ b/tests/testthat/test-dplyr-joins.R @@ -390,7 +390,7 @@ test_that("LEFT JOIN - unmatched throws error", { relationship = "many-to-many", by = "id1=id2", unmatched = "error") |> - expect_no_error() + expect_error() left_join(x = x1, y = y1, @@ -399,6 +399,23 @@ test_that("LEFT JOIN - unmatched throws error", { unmatched = "error") |> expect_error() + + left_join(x = x4, + y = y4, + relationship = "many-to-many", + by = c("id2", "x"), + unmatched = "error") |> + expect_error() + + left_join(x = x4, + y = y4, + relationship = "many-to-many", + by = c("id1=id2", "id2=id"), + unmatched = "error") |> + expect_error() + + + }) @@ -722,6 +739,21 @@ test_that("RIGHT JOIN - unmatched error", { unmatched = "error") |> expect_error() + right_join(x = x4, + y = y4, + relationship = "many-to-many", + by = c("id2", "x"), + unmatched = "error") |> + expect_error() + + right_join(x = x4, + y = y4, + relationship = "many-to-many", + by = c("id1=id2", "id2=id"), + unmatched = "error") |> + expect_no_error() + + }) #------------------------------------------------------------------------------- @@ -1602,5 +1634,19 @@ test_that("INNER JOIN - unmatched error", { unmatched = "error") |> expect_error() + inner_join(x = x4, + y = y4, + relationship = "many-to-many", + by = c("id2", "x"), + unmatched = "error") |> + expect_error() + + inner_join(x = x4, + y = y4, + relationship = "many-to-many", + by = c("id1=id2", "id2=id"), + unmatched = "error") |> + expect_error() + })