From fcccbda439e0d069f4c897944dd9e3c1639e91bf Mon Sep 17 00:00:00 2001 From: Jeff Thompson <160783290+jthompson-arcus@users.noreply.github.com> Date: Thu, 11 Jul 2024 09:19:37 -0400 Subject: [PATCH 01/13] Allow `NULL` for `input$region_selection` --- R/mod_review_config.R | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/R/mod_review_config.R b/R/mod_review_config.R index ed64d9f4..09698b50 100644 --- a/R/mod_review_config.R +++ b/R/mod_review_config.R @@ -113,7 +113,6 @@ mod_review_config_server <- function( observeEvent(input$config_review, showModal(review_modal())) observeEvent(input$region_selection, { - req(input$region_selection, input$site_selection) selected_sites <- with(sites, site_code[region %in% input$region_selection]) golem::cat_dev("update region selection to ", selected_sites, "\n") shinyWidgets::updatePickerInput( @@ -122,7 +121,7 @@ mod_review_config_server <- function( choices = selected_sites, selected = selected_sites ) - }) + }, ignoreNULL = FALSE, ignoreInit = TRUE) observeEvent(input$save_review_config, { golem::cat_dev("\nStart applying global configuration\n") From 047fc911dbf0cb78543836661170cb681fde3822 Mon Sep 17 00:00:00 2001 From: Jeff Thompson <160783290+jthompson-arcus@users.noreply.github.com> Date: Thu, 11 Jul 2024 09:35:29 -0400 Subject: [PATCH 02/13] Give feedback if either no sites are selected --- R/mod_review_config.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/mod_review_config.R b/R/mod_review_config.R index 09698b50..4c9d313f 100644 --- a/R/mod_review_config.R +++ b/R/mod_review_config.R @@ -123,6 +123,11 @@ mod_review_config_server <- function( ) }, ignoreNULL = FALSE, ignoreInit = TRUE) + output$review_config_feedback <- renderText({ + req(!isTruthy(input$region_selection) | !isTruthy(input$site_selection)) + "You must select at least one site/region to review." + }) + observeEvent(input$save_review_config, { golem::cat_dev("\nStart applying global configuration\n") req(input$site_selection) From 9be34fb5cc4777ca77d6660d835685708ad2fac6 Mon Sep 17 00:00:00 2001 From: Jeff Thompson <160783290+jthompson-arcus@users.noreply.github.com> Date: Thu, 11 Jul 2024 09:41:01 -0400 Subject: [PATCH 03/13] Update NEWS --- DESCRIPTION | 2 +- NEWS.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 091b744c..53279592 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: clinsight Title: ClinSight -Version: 0.0.0.9004 +Version: 0.0.0.9005 Authors@R: c( person("Leonard Daniël", "Samson", , "lsamson@gcp-service.com", role = c("cre", "aut")), person("GCP-Service International Ltd.& Co. KG", role = "fnd") diff --git a/NEWS.md b/NEWS.md index 0569b3f6..1de72a90 100644 --- a/NEWS.md +++ b/NEWS.md @@ -17,3 +17,4 @@ to minimize the package dependencies of the production version. ## Bug fixes - Fixed error of creating adverse events table with empty data frame input. +- Properly handled zero regions selected in review configuration and provided user feedback. From 831dbe799475a798414bb2b2b51caf1906c3411b Mon Sep 17 00:00:00 2001 From: Jeff Thompson <160783290+jthompson-arcus@users.noreply.github.com> Date: Thu, 11 Jul 2024 10:05:39 -0400 Subject: [PATCH 04/13] Account for `review_config_feedback` in tests --- .../_snaps/mod_review_config/mod_review_config-001.json | 9 ++++++++- .../_snaps/mod_review_config/mod_review_config-002.json | 9 ++++++++- .../_snaps/mod_review_config/mod_review_config-003.json | 9 ++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/tests/testthat/_snaps/mod_review_config/mod_review_config-001.json b/tests/testthat/_snaps/mod_review_config/mod_review_config-001.json index 275b750e..acca5029 100644 --- a/tests/testthat/_snaps/mod_review_config/mod_review_config-001.json +++ b/tests/testthat/_snaps/mod_review_config/mod_review_config-001.json @@ -20,6 +20,13 @@ ] }, "output": { - + "test-review_config_feedback": { + "message": "", + "call": "NULL", + "type": [ + "shiny.silent.error", + "validation" + ] + } } } diff --git a/tests/testthat/_snaps/mod_review_config/mod_review_config-002.json b/tests/testthat/_snaps/mod_review_config/mod_review_config-002.json index 18bf37dd..7b56b1cd 100644 --- a/tests/testthat/_snaps/mod_review_config/mod_review_config-002.json +++ b/tests/testthat/_snaps/mod_review_config/mod_review_config-002.json @@ -9,6 +9,13 @@ ] }, "output": { - + "test-review_config_feedback": { + "message": "", + "call": "NULL", + "type": [ + "shiny.silent.error", + "validation" + ] + } } } diff --git a/tests/testthat/_snaps/mod_review_config/mod_review_config-003.json b/tests/testthat/_snaps/mod_review_config/mod_review_config-003.json index f21deca0..9ee8821e 100644 --- a/tests/testthat/_snaps/mod_review_config/mod_review_config-003.json +++ b/tests/testthat/_snaps/mod_review_config/mod_review_config-003.json @@ -9,6 +9,13 @@ ] }, "output": { - + "test-review_config_feedback": { + "message": "", + "call": "NULL", + "type": [ + "shiny.silent.error", + "validation" + ] + } } } From 4395211376458fc0b31c287158b29caedb6a899a Mon Sep 17 00:00:00 2001 From: Jeff Thompson <160783290+jthompson-arcus@users.noreply.github.com> Date: Thu, 11 Jul 2024 10:25:28 -0400 Subject: [PATCH 05/13] Rename third test snapshot for `mod_review_config` --- ...w_config-003.json => mod_review_config-004.json} | 0 ...w_config-003_.png => mod_review_config-004_.png} | Bin 2 files changed, 0 insertions(+), 0 deletions(-) rename tests/testthat/_snaps/mod_review_config/{mod_review_config-003.json => mod_review_config-004.json} (100%) rename tests/testthat/_snaps/mod_review_config/{mod_review_config-003_.png => mod_review_config-004_.png} (100%) diff --git a/tests/testthat/_snaps/mod_review_config/mod_review_config-003.json b/tests/testthat/_snaps/mod_review_config/mod_review_config-004.json similarity index 100% rename from tests/testthat/_snaps/mod_review_config/mod_review_config-003.json rename to tests/testthat/_snaps/mod_review_config/mod_review_config-004.json diff --git a/tests/testthat/_snaps/mod_review_config/mod_review_config-003_.png b/tests/testthat/_snaps/mod_review_config/mod_review_config-004_.png similarity index 100% rename from tests/testthat/_snaps/mod_review_config/mod_review_config-003_.png rename to tests/testthat/_snaps/mod_review_config/mod_review_config-004_.png From 86ff65565f235acf5a58adcf1262fc1c92898e03 Mon Sep 17 00:00:00 2001 From: Jeff Thompson <160783290+jthompson-arcus@users.noreply.github.com> Date: Thu, 11 Jul 2024 10:26:12 -0400 Subject: [PATCH 06/13] Rename second test snapshot for `mod_review_config` --- ...w_config-002.json => mod_review_config-003.json} | 0 ...w_config-002_.png => mod_review_config-003_.png} | Bin 2 files changed, 0 insertions(+), 0 deletions(-) rename tests/testthat/_snaps/mod_review_config/{mod_review_config-002.json => mod_review_config-003.json} (100%) rename tests/testthat/_snaps/mod_review_config/{mod_review_config-002_.png => mod_review_config-003_.png} (100%) diff --git a/tests/testthat/_snaps/mod_review_config/mod_review_config-002.json b/tests/testthat/_snaps/mod_review_config/mod_review_config-003.json similarity index 100% rename from tests/testthat/_snaps/mod_review_config/mod_review_config-002.json rename to tests/testthat/_snaps/mod_review_config/mod_review_config-003.json diff --git a/tests/testthat/_snaps/mod_review_config/mod_review_config-002_.png b/tests/testthat/_snaps/mod_review_config/mod_review_config-003_.png similarity index 100% rename from tests/testthat/_snaps/mod_review_config/mod_review_config-002_.png rename to tests/testthat/_snaps/mod_review_config/mod_review_config-003_.png From 571accde912a63e4c0aff4ee77ecb34711534712 Mon Sep 17 00:00:00 2001 From: Jeff Thompson <160783290+jthompson-arcus@users.noreply.github.com> Date: Thu, 11 Jul 2024 10:30:36 -0400 Subject: [PATCH 07/13] Add test for zero regions selected in `mod_review_config` --- .../mod_review_config-002.json | 11 +++++++++++ .../mod_review_config-002_.png | Bin 0 -> 23647 bytes tests/testthat/test-mod_review_config.R | 2 ++ 3 files changed, 13 insertions(+) create mode 100644 tests/testthat/_snaps/mod_review_config/mod_review_config-002.json create mode 100644 tests/testthat/_snaps/mod_review_config/mod_review_config-002_.png diff --git a/tests/testthat/_snaps/mod_review_config/mod_review_config-002.json b/tests/testthat/_snaps/mod_review_config/mod_review_config-002.json new file mode 100644 index 00000000..64597ce4 --- /dev/null +++ b/tests/testthat/_snaps/mod_review_config/mod_review_config-002.json @@ -0,0 +1,11 @@ +{ + "input": { + "test-config_review": 1, + "test-region_selection": null, + "test-save_review_config": 0, + "test-site_selection": null + }, + "output": { + "test-review_config_feedback": "You must select at least one site/region to review." + } +} diff --git a/tests/testthat/_snaps/mod_review_config/mod_review_config-002_.png b/tests/testthat/_snaps/mod_review_config/mod_review_config-002_.png new file mode 100644 index 0000000000000000000000000000000000000000..44cfd3a2cbcdd7e8ce9883bd928b8c61a4e65309 GIT binary patch literal 23647 zcmeIa2UJvBwuB z&KaSgprC-BrT@LR$LQ{R`~L5~e*MNcH5^jx+O_stbI$e6Z-&MD=h9;5&XAu$AQ0!C zJ$)jFK%9_AAdZ!tIto{0qGt5r#}OMjF=0ej`^^Oe;!ni0Cyx{yW0psp)O#=o4eQ6w zkDv81O-wXQxD`dR`c*GXA}ca2d9=B^JHOmW&qxCu9U2xIrk`eHlrsCNBwQlWH=)?$ z)+N6?_ZZkbl3Gul{kb=_89kfpU*i*q-P&^5@pj=E!|undg|F(3#@SR#v+K8B5I#j? zK3x1UK3?m^ix=wZOfV_p%X@Npd3kbja&}g!!r9L03GLf^3=F0AD^bD0!DVI00%J@} zOw6(d-S4}f^U%`Liin6fIXQ8g4}XKLq$GW?jrKYuY12=KUC8@slHc!|pKKie{Z8)|o~Szn!h`MOzYeERWNrQE zI znE2__C1m)qWX5J`U*3)IQ^wSzJ!Mf9en)PCDFmm(Dj7nfqoYCG6)i^)Gkg`t^XsZ{NOs`QrFv zCwy7s6k=Sdg2O!H0xcNV=sN`BFVJ-{ADEfL!tlV*&=B#Od1z3OjAN=anD#dZ8U%u9 zN~`BZM0JDj2CQftM&v2}JnM=Bpdd?lx$p%EoMSi=J>%2N3r zJ$>5DoWU9c0-=~xSmkbIl~aKNllm8PJ0tS%n%jS|_5Ry%g?F?t=^w*?+wXXL4s%fM z%uQ}(Ws3ISHjglsA4%bF4x4Vlh|DC)4Org#ZG6vFvRD|%$kcw^qv&HUHA%nh_KzX# zZDi9p78eU+O_0trS!tTjpGRmtf1#jmYV!}&_^TwHhp()pw6t_EPHUvQoLO0!Oj$Wx zZ2<;I8}}NmJpO8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CDQ&d1id&8fUmb_0K3wi3IE6 zLV7&uz`fgD+0@RREENZfsO&h%)O-jyhN!wkgu4HPS3R5HHkM0wU9_ySUp$$OBgy{> z5~FkEX(ACYJ!Hi~1*-3p+qGtm=E&&Qbo#ShT2b^n{^xt})!z|!4@G2!J}=XFiPY>& zj+;1aL7qZ%jaEh&j;!wEC^d+V;W|<5#~zL+>JS$6NFOlO$0|yeS}I$RvzO{A*q}Sl za^(7(8<7j7Coj_@wC@w$$O-#RZr{^$*FuLY<&Eg?#%bN$XZ0*YcGp@ZsYW?$OWtnz z8aBI6=g){dgSdW&h)&y^6BcA*!?ON@m0zjlarep;_ak&R*Xt~X6>nlQNjJDoO5WtQ z8t!)`r}$wnsKgKoZ|(-}6&$Y2Y>zHWy|T|zNHC`sE-Z-XZPtI6koq^-Z7 z_|H)Kzoq*BMxgY!RR5Oh|7FhXZ+QG09{-EeL4Tv%-zfJt%Kc4r|A|cU-_Y?lbo>n+ d|7W3NUuda4(M7;9=T{x;nTYh0EMe_8{|%-6Jc0lK literal 0 HcmV?d00001 diff --git a/tests/testthat/test-mod_review_config.R b/tests/testthat/test-mod_review_config.R index 2d7d257c..9163126a 100644 --- a/tests/testthat/test-mod_review_config.R +++ b/tests/testthat/test-mod_review_config.R @@ -146,6 +146,8 @@ describe( withr::defer(app$stop()) app$click("test-config_review") app$expect_values(input = TRUE, output = TRUE) + app$set_inputs(`test-region_selection` = "") + app$expect_values(input = TRUE, output = TRUE) app$set_inputs(`test-region_selection` = "DEU") app$expect_values(input = TRUE, output = TRUE) app$click("test-save_review_config") From 18002fec124c9da2d6387ccf427fc0753913b92b Mon Sep 17 00:00:00 2001 From: Jeff Thompson <160783290+jthompson-arcus@users.noreply.github.com> Date: Fri, 12 Jul 2024 11:53:32 -0400 Subject: [PATCH 08/13] Update test for `mod_review_config` to include trying to save empty selection --- .../mod_review_config-003.json | 2 +- .../mod_review_config-004.json | 2 +- tests/testthat/test-mod_review_config.R | 197 ++++++++++-------- 3 files changed, 107 insertions(+), 94 deletions(-) diff --git a/tests/testthat/_snaps/mod_review_config/mod_review_config-003.json b/tests/testthat/_snaps/mod_review_config/mod_review_config-003.json index 7b56b1cd..9ee8821e 100644 --- a/tests/testthat/_snaps/mod_review_config/mod_review_config-003.json +++ b/tests/testthat/_snaps/mod_review_config/mod_review_config-003.json @@ -2,7 +2,7 @@ "input": { "test-config_review": 1, "test-region_selection": "DEU", - "test-save_review_config": 0, + "test-save_review_config": 1, "test-site_selection": [ "Site 01", "Site 02" diff --git a/tests/testthat/_snaps/mod_review_config/mod_review_config-004.json b/tests/testthat/_snaps/mod_review_config/mod_review_config-004.json index 9ee8821e..a9e0668a 100644 --- a/tests/testthat/_snaps/mod_review_config/mod_review_config-004.json +++ b/tests/testthat/_snaps/mod_review_config/mod_review_config-004.json @@ -2,7 +2,7 @@ "input": { "test-config_review": 1, "test-region_selection": "DEU", - "test-save_review_config": 1, + "test-save_review_config": 2, "test-site_selection": [ "Site 01", "Site 02" diff --git a/tests/testthat/test-mod_review_config.R b/tests/testthat/test-mod_review_config.R index 9163126a..64822235 100644 --- a/tests/testthat/test-mod_review_config.R +++ b/tests/testthat/test-mod_review_config.R @@ -1,44 +1,45 @@ -describe( - "mod_review_config. Feature 1 | As a user, I want to be able to select my user +test_that("mod_review_config works", { + describe( + "Feature 1 | As a user, I want to be able to select my user configuration before I start to perform a review. I want to be able to configure the regions and the sites that I will review. After selecting these, the data should be filtered so that only data from the filtered regions/sites will be shown.", - { - appdata <- get_appdata(clinsightful_data) - vars <- get_meta_vars(appdata, metadata) - apptables <- list("tab1" = data.frame(subject_id = vars$subject_id)) - - testargs <- list( - r = reactiveValues(subject_id = "DEU_02_866", - filtered_data = appdata, - filtered_tables = apptables, - filtered_subjects = vars$subject_id), - app_data = appdata, - app_tables = apptables, - sites = vars$Sites, - subject_ids = vars$subject_id - ) - it("Can load the module UI, with functioning internal parameters.", { - ui <- mod_review_config_ui(id = "test") - golem::expect_shinytaglist(ui) - # Check that formals have not been removed - fmls <- formals(mod_review_config_ui) - for (i in c("id")){ - expect_true(i %in% names(fmls)) - } - }) - - it("Can load the module server, with functioning internal parameters.", { - testServer(mod_review_config_server, args = testargs, { - ns <- session$ns - expect_true(inherits(ns, "function")) - expect_true(grepl(id, ns(""))) - expect_true(grepl("test", ns("test"))) + { + appdata <- get_appdata(clinsightful_data) + vars <- get_meta_vars(appdata, metadata) + apptables <- list("tab1" = data.frame(subject_id = vars$subject_id)) + + testargs <- list( + r = reactiveValues(subject_id = "DEU_02_866", + filtered_data = appdata, + filtered_tables = apptables, + filtered_subjects = vars$subject_id), + app_data = appdata, + app_tables = apptables, + sites = vars$Sites, + subject_ids = vars$subject_id + ) + it("Can load the module UI, with functioning internal parameters.", { + ui <- mod_review_config_ui(id = "test") + golem::expect_shinytaglist(ui) + # Check that formals have not been removed + fmls <- formals(mod_review_config_ui) + for (i in c("id")){ + expect_true(i %in% names(fmls)) + } + }) + + it("Can load the module server, with functioning internal parameters.", { + testServer(mod_review_config_server, args = testargs, { + ns <- session$ns + expect_true(inherits(ns, "function")) + expect_true(grepl(id, ns(""))) + expect_true(grepl("test", ns("test"))) + }) }) - }) - - it("Scenario 1. Given a test data set with random data, + + it("Scenario 1. Given a test data set with random data, and and a site name was provided that is not available in the test data set, I expect that a warning will be given with the text 'Not all sites are found in the appdata'.", { testargs$sites <- testargs$sites |> @@ -49,9 +50,9 @@ describe( "Not all sites are found in the appdata." ) }) - - - it("Scenario 2. Filters data and subject ids as expected. + + + it("Scenario 2. Filters data and subject ids as expected. Given a test data set with random data containing the regions 'BEL', 'NLD', and 'DEU', I expect that the regions are initially set to 'BEL', 'NLD', and 'DEU', and given that I select the region 'NLD' and press the [Save] button, @@ -82,7 +83,7 @@ describe( expect_true(all(grepl("^NLD_", subjects))) }) }) - it("Scenario 3. Warns if only sites are selected that are not in the app data set. + it("Scenario 3. Warns if only sites are selected that are not in the app data set. Given a test data set with random data, and region is set to 'NLD', and site selection is set only to the non-existent 'Site x', @@ -101,67 +102,79 @@ describe( ) }) }) - it( - "Scenario 4. Given a test data set containing regions 'NLD', 'DEU', and 'BEL', + it( + "Scenario 4. Given a test data set containing regions 'NLD', 'DEU', and 'BEL', and sites 'Site 01' and 'Site 02' belonging to region 'DEU', and clicking on [settings], I expect to see the modal to select regions and sites to review, - and given that I deselect regions 'NLD' and 'BEL', - I expect that only the sites 'Site 01' and 'Site 02' are still selected, + and given that I deselect all regions and click on [Save], + I expect that I will get the message 'You must select at least one site/region to review.', + and that the data within the app will not be updated with the empty selection, + and given that I select region 'DEU', + I expect that only the sites 'Site 01' and 'Site 02' will be selected, and given that I click on [Save], I expect that a confirmation will be shown with the text 'Review configuration applied successfully', and that the data within the app only contains data of 'Site 01' and 'Site 02'. ", - { - test_ui <- function(request){ - tagList( - shinyjs::useShinyjs(), - bslib::page( - bslib::card( - mod_review_config_ui("test") + { + test_ui <- function(request){ + tagList( + shinyjs::useShinyjs(), + bslib::page( + bslib::card( + clinsight:::mod_review_config_ui("test") + ) ) ) + } + test_server <- function(input, output, session){ + r = reactiveValues( + subject_id = "DEU_02_866", + filtered_data = appdata, + filtered_tables = apptables, + filtered_subjects = vars$subject_id + ) + + clinsight:::mod_review_config_server( + "test", r, app_data = appdata, + app_tables = apptables, sites = vars$Sites, subject_ids = vars$subject_id + ) + exportTestValues(filtered_data = r$filtered_data) + } + test_app <- shinyApp(test_ui, test_server, options = list("test.mode" = TRUE)) + app <- shinytest2::AppDriver$new( + app_dir = test_app, + name = "mod_review_config", + width = 1619, + height = 955 ) - } - test_server <- function(input, output, session){ - r = reactiveValues( - subject_id = "DEU_02_866", - filtered_data = appdata, - filtered_tables = apptables, - filtered_subjects = vars$subject_id + withr::defer(app$stop()) + app$click("test-config_review") + app$expect_values(input = TRUE, output = TRUE) + app$set_inputs(`test-region_selection` = "") + app$expect_values(input = TRUE, output = TRUE) + app$click("test-save_review_config") + filtered_data <- app$get_value(export = "filtered_data") + all_sites <- lapply(filtered_data, \(x){x[["site_code"]]}) |> + unlist() |> + unique() + expect_equal( + all_sites[order(all_sites)], + sort(vars$Sites$site_code) ) - - mod_review_config_server( - "test", r, app_data = appdata, - app_tables = apptables, sites = vars$Sites, subject_ids = vars$subject_id + app$set_inputs(`test-region_selection` = "DEU") + app$expect_values(input = TRUE, output = TRUE) + app$click("test-save_review_config") + app$expect_values(input = TRUE, output = TRUE) + filtered_data <- app$get_value(export = "filtered_data") + all_sites <- lapply(filtered_data, \(x){x[["site_code"]]}) |> + unlist() |> + unique() + expect_equal( + all_sites[order(all_sites)], + c("Site 01", "Site 02") ) - exportTestValues(filtered_data = r$filtered_data) } - test_app <- shinyApp(test_ui, test_server, options = list("test.mode" = TRUE)) - app <- shinytest2::AppDriver$new( - app_dir = test_app, - name = "mod_review_config", - width = 1619, - height = 955 - ) - withr::defer(app$stop()) - app$click("test-config_review") - app$expect_values(input = TRUE, output = TRUE) - app$set_inputs(`test-region_selection` = "") - app$expect_values(input = TRUE, output = TRUE) - app$set_inputs(`test-region_selection` = "DEU") - app$expect_values(input = TRUE, output = TRUE) - app$click("test-save_review_config") - app$expect_values(input = TRUE, output = TRUE) - filtered_data <- app$get_value(export = "filtered_data") - all_sites <- lapply(filtered_data, \(x){x[["site_code"]]}) |> - unlist() |> - unique() - expect_equal( - all_sites[order(all_sites)], - c("Site 01", "Site 02") - ) - } - ) - } -) - + ) + } + ) +}) From d898dd62a51e2460dfcd06b6526cbc049cd3ebfb Mon Sep 17 00:00:00 2001 From: Jeff Thompson <160783290+jthompson-arcus@users.noreply.github.com> Date: Fri, 12 Jul 2024 11:59:47 -0400 Subject: [PATCH 09/13] Decided to remove `test_that()` wrapper --- tests/testthat/test-mod_review_config.R | 196 ++++++++++++------------ 1 file changed, 97 insertions(+), 99 deletions(-) diff --git a/tests/testthat/test-mod_review_config.R b/tests/testthat/test-mod_review_config.R index 64822235..4e444c97 100644 --- a/tests/testthat/test-mod_review_config.R +++ b/tests/testthat/test-mod_review_config.R @@ -1,45 +1,44 @@ -test_that("mod_review_config works", { - describe( +describe( "Feature 1 | As a user, I want to be able to select my user configuration before I start to perform a review. I want to be able to configure the regions and the sites that I will review. After selecting these, the data should be filtered so that only data from the filtered regions/sites will be shown.", - { - appdata <- get_appdata(clinsightful_data) - vars <- get_meta_vars(appdata, metadata) - apptables <- list("tab1" = data.frame(subject_id = vars$subject_id)) - - testargs <- list( - r = reactiveValues(subject_id = "DEU_02_866", - filtered_data = appdata, - filtered_tables = apptables, - filtered_subjects = vars$subject_id), - app_data = appdata, - app_tables = apptables, - sites = vars$Sites, - subject_ids = vars$subject_id - ) - it("Can load the module UI, with functioning internal parameters.", { - ui <- mod_review_config_ui(id = "test") - golem::expect_shinytaglist(ui) - # Check that formals have not been removed - fmls <- formals(mod_review_config_ui) - for (i in c("id")){ - expect_true(i %in% names(fmls)) - } - }) - - it("Can load the module server, with functioning internal parameters.", { - testServer(mod_review_config_server, args = testargs, { - ns <- session$ns - expect_true(inherits(ns, "function")) - expect_true(grepl(id, ns(""))) - expect_true(grepl("test", ns("test"))) - }) + { + appdata <- get_appdata(clinsightful_data) + vars <- get_meta_vars(appdata, metadata) + apptables <- list("tab1" = data.frame(subject_id = vars$subject_id)) + + testargs <- list( + r = reactiveValues(subject_id = "DEU_02_866", + filtered_data = appdata, + filtered_tables = apptables, + filtered_subjects = vars$subject_id), + app_data = appdata, + app_tables = apptables, + sites = vars$Sites, + subject_ids = vars$subject_id + ) + it("Can load the module UI, with functioning internal parameters.", { + ui <- mod_review_config_ui(id = "test") + golem::expect_shinytaglist(ui) + # Check that formals have not been removed + fmls <- formals(mod_review_config_ui) + for (i in c("id")){ + expect_true(i %in% names(fmls)) + } + }) + + it("Can load the module server, with functioning internal parameters.", { + testServer(mod_review_config_server, args = testargs, { + ns <- session$ns + expect_true(inherits(ns, "function")) + expect_true(grepl(id, ns(""))) + expect_true(grepl("test", ns("test"))) }) - - it("Scenario 1. Given a test data set with random data, + }) + + it("Scenario 1. Given a test data set with random data, and and a site name was provided that is not available in the test data set, I expect that a warning will be given with the text 'Not all sites are found in the appdata'.", { testargs$sites <- testargs$sites |> @@ -50,9 +49,9 @@ test_that("mod_review_config works", { "Not all sites are found in the appdata." ) }) - - - it("Scenario 2. Filters data and subject ids as expected. + + + it("Scenario 2. Filters data and subject ids as expected. Given a test data set with random data containing the regions 'BEL', 'NLD', and 'DEU', I expect that the regions are initially set to 'BEL', 'NLD', and 'DEU', and given that I select the region 'NLD' and press the [Save] button, @@ -83,7 +82,7 @@ test_that("mod_review_config works", { expect_true(all(grepl("^NLD_", subjects))) }) }) - it("Scenario 3. Warns if only sites are selected that are not in the app data set. + it("Scenario 3. Warns if only sites are selected that are not in the app data set. Given a test data set with random data, and region is set to 'NLD', and site selection is set only to the non-existent 'Site x', @@ -102,8 +101,8 @@ test_that("mod_review_config works", { ) }) }) - it( - "Scenario 4. Given a test data set containing regions 'NLD', 'DEU', and 'BEL', + it( + "Scenario 4. Given a test data set containing regions 'NLD', 'DEU', and 'BEL', and sites 'Site 01' and 'Site 02' belonging to region 'DEU', and clicking on [settings], I expect to see the modal to select regions and sites to review, @@ -115,66 +114,65 @@ test_that("mod_review_config works", { and given that I click on [Save], I expect that a confirmation will be shown with the text 'Review configuration applied successfully', and that the data within the app only contains data of 'Site 01' and 'Site 02'. ", - { - test_ui <- function(request){ - tagList( - shinyjs::useShinyjs(), - bslib::page( - bslib::card( - clinsight:::mod_review_config_ui("test") - ) + { + test_ui <- function(request){ + tagList( + shinyjs::useShinyjs(), + bslib::page( + bslib::card( + clinsight:::mod_review_config_ui("test") ) ) - } - test_server <- function(input, output, session){ - r = reactiveValues( - subject_id = "DEU_02_866", - filtered_data = appdata, - filtered_tables = apptables, - filtered_subjects = vars$subject_id - ) - - clinsight:::mod_review_config_server( - "test", r, app_data = appdata, - app_tables = apptables, sites = vars$Sites, subject_ids = vars$subject_id - ) - exportTestValues(filtered_data = r$filtered_data) - } - test_app <- shinyApp(test_ui, test_server, options = list("test.mode" = TRUE)) - app <- shinytest2::AppDriver$new( - app_dir = test_app, - name = "mod_review_config", - width = 1619, - height = 955 ) - withr::defer(app$stop()) - app$click("test-config_review") - app$expect_values(input = TRUE, output = TRUE) - app$set_inputs(`test-region_selection` = "") - app$expect_values(input = TRUE, output = TRUE) - app$click("test-save_review_config") - filtered_data <- app$get_value(export = "filtered_data") - all_sites <- lapply(filtered_data, \(x){x[["site_code"]]}) |> - unlist() |> - unique() - expect_equal( - all_sites[order(all_sites)], - sort(vars$Sites$site_code) + } + test_server <- function(input, output, session){ + r = reactiveValues( + subject_id = "DEU_02_866", + filtered_data = appdata, + filtered_tables = apptables, + filtered_subjects = vars$subject_id ) - app$set_inputs(`test-region_selection` = "DEU") - app$expect_values(input = TRUE, output = TRUE) - app$click("test-save_review_config") - app$expect_values(input = TRUE, output = TRUE) - filtered_data <- app$get_value(export = "filtered_data") - all_sites <- lapply(filtered_data, \(x){x[["site_code"]]}) |> - unlist() |> - unique() - expect_equal( - all_sites[order(all_sites)], - c("Site 01", "Site 02") + + clinsight:::mod_review_config_server( + "test", r, app_data = appdata, + app_tables = apptables, sites = vars$Sites, subject_ids = vars$subject_id ) + exportTestValues(filtered_data = r$filtered_data) } - ) - } - ) -}) + test_app <- shinyApp(test_ui, test_server, options = list("test.mode" = TRUE)) + app <- shinytest2::AppDriver$new( + app_dir = test_app, + name = "mod_review_config", + width = 1619, + height = 955 + ) + withr::defer(app$stop()) + app$click("test-config_review") + app$expect_values(input = TRUE, output = TRUE) + app$set_inputs(`test-region_selection` = "") + app$expect_values(input = TRUE, output = TRUE) + app$click("test-save_review_config") + filtered_data <- app$get_value(export = "filtered_data") + all_sites <- lapply(filtered_data, \(x){x[["site_code"]]}) |> + unlist() |> + unique() + expect_equal( + all_sites[order(all_sites)], + sort(vars$Sites$site_code) + ) + app$set_inputs(`test-region_selection` = "DEU") + app$expect_values(input = TRUE, output = TRUE) + app$click("test-save_review_config") + app$expect_values(input = TRUE, output = TRUE) + filtered_data <- app$get_value(export = "filtered_data") + all_sites <- lapply(filtered_data, \(x){x[["site_code"]]}) |> + unlist() |> + unique() + expect_equal( + all_sites[order(all_sites)], + c("Site 01", "Site 02") + ) + } + ) + } +) From 9225e8473e9874fcbdd8a880754c46fe27f7d904 Mon Sep 17 00:00:00 2001 From: Jeff Thompson <160783290+jthompson-arcus@users.noreply.github.com> Date: Fri, 12 Jul 2024 12:05:59 -0400 Subject: [PATCH 10/13] Add back deleted text from description --- tests/testthat/test-mod_review_config.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-mod_review_config.R b/tests/testthat/test-mod_review_config.R index 4e444c97..f484a8e3 100644 --- a/tests/testthat/test-mod_review_config.R +++ b/tests/testthat/test-mod_review_config.R @@ -1,5 +1,5 @@ describe( - "Feature 1 | As a user, I want to be able to select my user + "mode_review_config. Feature 1 | As a user, I want to be able to select my user configuration before I start to perform a review. I want to be able to configure the regions and the sites that I will review. After selecting these, the data should be filtered so that only data from the filtered regions/sites From ee51de860771a8ca1a89fa873097cc30592c0b48 Mon Sep 17 00:00:00 2001 From: Jeff Thompson <160783290+jthompson-arcus@users.noreply.github.com> Date: Fri, 12 Jul 2024 12:06:53 -0400 Subject: [PATCH 11/13] Fix typo --- tests/testthat/test-mod_review_config.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-mod_review_config.R b/tests/testthat/test-mod_review_config.R index f484a8e3..d68101df 100644 --- a/tests/testthat/test-mod_review_config.R +++ b/tests/testthat/test-mod_review_config.R @@ -1,5 +1,5 @@ describe( - "mode_review_config. Feature 1 | As a user, I want to be able to select my user + "mod_review_config. Feature 1 | As a user, I want to be able to select my user configuration before I start to perform a review. I want to be able to configure the regions and the sites that I will review. After selecting these, the data should be filtered so that only data from the filtered regions/sites From 355443b6a176ee879d8087a39b445aa66a8a73f5 Mon Sep 17 00:00:00 2001 From: Jeff Thompson <160783290+jthompson-arcus@users.noreply.github.com> Date: Fri, 12 Jul 2024 12:26:44 -0400 Subject: [PATCH 12/13] Update version number --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 53279592..1c740367 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: clinsight Title: ClinSight -Version: 0.0.0.9005 +Version: 0.0.0.9006 Authors@R: c( person("Leonard Daniël", "Samson", , "lsamson@gcp-service.com", role = c("cre", "aut")), person("GCP-Service International Ltd.& Co. KG", role = "fnd") From c119c573abf0c7ce40183cf1f01dd7a9fd39da8b Mon Sep 17 00:00:00 2001 From: Jeff Thompson <160783290+jthompson-arcus@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:15:06 -0400 Subject: [PATCH 13/13] Remove `clinsight:::function()` calls --- tests/testthat/test-mod_review_config.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test-mod_review_config.R b/tests/testthat/test-mod_review_config.R index d68101df..6d672a49 100644 --- a/tests/testthat/test-mod_review_config.R +++ b/tests/testthat/test-mod_review_config.R @@ -120,7 +120,7 @@ describe( shinyjs::useShinyjs(), bslib::page( bslib::card( - clinsight:::mod_review_config_ui("test") + mod_review_config_ui("test") ) ) ) @@ -133,7 +133,7 @@ describe( filtered_subjects = vars$subject_id ) - clinsight:::mod_review_config_server( + mod_review_config_server( "test", r, app_data = appdata, app_tables = apptables, sites = vars$Sites, subject_ids = vars$subject_id )