Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #1466 Unit test for print.duplicates() which closes test coverage gap #2055

Merged
merged 6 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tests/testthat/_snaps/duplicates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# signal_duplicate_records Test 2: dataset of duplicate records can be accessed using `get_duplicates_dataset()`

Code
get_duplicates_dataset()
Output
Duplicate records with respect to `USUBJID`.
# A tibble: 4 x 3
USUBJID COUNTRY AAGE
* <chr> <chr> <dbl>
1 P01 GER 22
2 P01 JPN 34
3 P04 BRA 21
4 P04 BRA 21

10 changes: 8 additions & 2 deletions tests/testthat/test-duplicates.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
test_that("duplicate records are extracted", {
# extract_duplicate_records ----
## Test 1: duplicate records are extracted ----
test_that("extract_duplicate_records Test 1: duplicate records are extracted", {
input <- tibble::tribble(
~USUBJID, ~COUNTRY, ~AAGE,
"P01", "GER", 22,
Expand All @@ -16,7 +18,9 @@ test_that("duplicate records are extracted", {
)
})

test_that("dataset of duplicate records can be accessed using `get_duplicates_dataset()`", {
# signal_duplicate_records ----
## Test 2: dataset of duplicate records can be accessed using `get_duplicates_dataset()` ----
test_that("signal_duplicate_records Test 2: dataset of duplicate records can be accessed using `get_duplicates_dataset()`", { # nolint
input <- tibble::tribble(
~USUBJID, ~COUNTRY, ~AAGE,
"P01", "GER", 22,
Expand All @@ -35,4 +39,6 @@ test_that("dataset of duplicate records can be accessed using `get_duplicates_da
)

expect_true(all(expected_ouput == get_duplicates_dataset()))

expect_snapshot(get_duplicates_dataset())
})
Loading