Skip to content

Commit

Permalink
Write unit test to reproduce the bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kelly-sovacool committed Aug 5, 2021
1 parent 20c3315 commit 1dff4d7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/testthat/test-preprocess_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,15 @@ test_that("rm_missing_outcome works", {
)
})

test_that('preprocess_data preserves numeric outcomes', {
test_df_int <- data.frame(outcome = 1:4, var1 = 1:4)
expect_equal(preprocess_data(test_df_int, 'outcome')$dat_transformed$outcome,
test_df_int$outcome)
test_df_dbl <- data.frame(outcome = c(1.1, 2.2, 3.3, 4.4), var1 = 1:4)
expect_equal(preprocess_data(test_df_dbl, 'outcome')$dat_transformed$outcome,
test_df_dbl$outcome)
})

test_that("change_to_num works", {
expect_equal(
change_to_num(dplyr::as_tibble(test_df[, 13])),
Expand Down

0 comments on commit 1dff4d7

Please sign in to comment.