mirror of
https://github.com/msberends/AMR.git
synced 2025-07-09 06:02:01 +02:00
(v1.4.0.9039) more unit tests
This commit is contained in:
@ -150,6 +150,8 @@ test_that("first isolates work", {
|
||||
col_date = "non-existing col",
|
||||
col_mo = "mo"))
|
||||
|
||||
require("dplyr")
|
||||
|
||||
# look for columns itself
|
||||
expect_message(first_isolate(example_isolates))
|
||||
expect_message(first_isolate(example_isolates %>%
|
||||
@ -166,6 +168,14 @@ test_that("first isolates work", {
|
||||
first_isolate(col_date = "date",
|
||||
col_mo = "mo",
|
||||
col_patient_id = "patient_id"))
|
||||
|
||||
# support for WHONET
|
||||
expect_message(example_isolates %>%
|
||||
select(-patient_id) %>%
|
||||
mutate(`First name` = "test",
|
||||
`Last name` = "test",
|
||||
Sex = "Female") %>%
|
||||
first_isolate(info = TRUE))
|
||||
|
||||
# missing dates should be no problem
|
||||
df <- example_isolates
|
||||
@ -203,6 +213,9 @@ test_that("first isolates work", {
|
||||
# notice that all mo's are distinct, so all are TRUE
|
||||
expect_true(all(example_isolates %pm>%
|
||||
pm_distinct(mo, .keep_all = TRUE) %pm>%
|
||||
first_isolate() == TRUE))
|
||||
first_isolate(info = TRUE) == TRUE))
|
||||
|
||||
# only one isolate, so return fast
|
||||
expect_true(first_isolate(data.frame(mo = "Escherichia coli", date = Sys.Date(), patient = "patient"), info = TRUE))
|
||||
|
||||
})
|
||||
|
Reference in New Issue
Block a user