Skip to content

Commit

Permalink
both arms --explicity
Browse files Browse the repository at this point in the history
ref #482
  • Loading branch information
wibeasley committed May 26, 2023
1 parent ff05a7d commit f3fcaea
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
structure(list(arm_num = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L
), unique_event_name = c("enrollment_arm_1", "enrollment_arm_1",
"enrollment_arm_1", "dose_1_arm_1", "visit_1_arm_1", "visit_1_arm_1",
"visit_1_arm_1", "visit_1_arm_1", "dose_2_arm_1", "visit_2_arm_1",
"visit_2_arm_1", "visit_2_arm_1", "visit_2_arm_1", "final_visit_arm_1",
"final_visit_arm_1", "enrollment_arm_2", "enrollment_arm_2",
"enrollment_arm_2", "deadline_to_opt_ou_arm_2", "first_dose_arm_2",
"first_visit_arm_2", "first_visit_arm_2", "final_visit_arm_2",
"final_visit_arm_2", "deadline_to_return_arm_2"), form = c("demographics",
"contact_info", "baseline_data", "patient_morale_questionnaire",
"visit_lab_data", "patient_morale_questionnaire", "visit_blood_workup",
"visit_observed_behavior", "patient_morale_questionnaire", "visit_lab_data",
"patient_morale_questionnaire", "visit_blood_workup", "visit_observed_behavior",
"completion_data", "completion_project_questionnaire", "demographics",
"contact_info", "baseline_data", "contact_info", "patient_morale_questionnaire",
"patient_morale_questionnaire", "visit_observed_behavior", "visit_observed_behavior",
"completion_project_questionnaire", "contact_info")), row.names = c(NA,
-25L), spec = structure(list(cols = list(arm_num = structure(list(), class = c("collector_integer",
"collector")), unique_event_name = structure(list(), class = c("collector_character",
"collector")), form = structure(list(), class = c("collector_character",
"collector"))), default = structure(list(), class = c("collector_guess",
"collector")), delim = ","), class = "col_spec"), class = c("spec_tbl_df",
"tbl_df", "tbl", "data.frame"))
24 changes: 24 additions & 0 deletions tests/testthat/test-event-instruments.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,30 @@ test_that("Smoke Test", {
)
})

test_that("2-arms-retrieve-both-arms", {
testthat::skip_on_cran()
credential <- retrieve_credential_testing(212L)
path_expected <- "test-data/specific-redcapr/event-instruments/2-arms-retrieve-both-arms.R"
expected_outcome_message <- "\\d+ event instrument metadata records were read from REDCap in \\d\\.\\d seconds\\. The http status code was 200\\.(\\n)?"

returned_object_explicit <-
redcap_event_instruments(
redcap_uri = credential$redcap_uri,
token = credential$token,
arms = c("1", "2"),
verbose = FALSE
)

if (update_expectation) save_expected(returned_object_explicit$data, path_expected)
expected_data_frame <- retrieve_expected(path_expected)

expect_equal( returned_object_explicit$data, expected=expected_data_frame, label="The returned data.frame should be correct", ignore_attr = TRUE) # dput(returned_object$data)
expect_equal( returned_object_explicit$status_code, expected=200L)
expect_equal( returned_object_explicit$raw_text, expected="", ignore_attr = TRUE) # dput(returned_object$raw_text)
expect_match( returned_object_explicit$outcome_message, regexp=expected_outcome_message, perl=TRUE)
expect_true( returned_object_explicit$success)
expect_s3_class(returned_object_explicit$data, "tbl")
})
test_that("2-arms-retrieve-only-arm-1", {
testthat::skip_on_cran()
credential <- retrieve_credential_testing(212L)
Expand Down

0 comments on commit f3fcaea

Please sign in to comment.