Skip to content

Commit 7209f68

Browse files
authored
test: ✅ add nrow() test of data created with pipeline (#182)
# Description So we not only tests the number of files but also the content of the files (at least the number of rows). Needs no review. ## Checklist - [X] Ran `just run-all`
1 parent d9bd996 commit 7209f68

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/testthat/test-targets.R

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,24 @@ test_that("targets pipeline template converts SAS files to Parquet", {
6666
length(parquet_files),
6767
sum(length(kontakter_list), length(diagnoser_list))
6868
)
69+
70+
# Check nrows per register.
71+
n_expected_kontakter <- sum(purrr::map_int(kontakter_list, nrow))
72+
n_expected_diagnoser <- sum(purrr::map_int(diagnoser_list, nrow))
73+
74+
n_actual_kontakter <- arrow::open_dataset(fs::path(
75+
output_dir,
76+
"kontakter"
77+
)) |>
78+
dplyr::collect() |>
79+
nrow()
80+
n_actual_diagnoser <- arrow::open_dataset(fs::path(
81+
output_dir,
82+
"diagnoser"
83+
)) |>
84+
dplyr::collect() |>
85+
nrow()
86+
87+
expect_equal(n_actual_kontakter, n_expected_kontakter)
88+
expect_equal(n_actual_diagnoser, n_expected_diagnoser)
6989
})

0 commit comments

Comments
 (0)