Skip to content

Commit

Permalink
lints and checks
Browse files Browse the repository at this point in the history
  • Loading branch information
zsigmas committed Oct 22, 2024
1 parent 62fa830 commit 4122a45
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 55 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
push:
branches:
- main
- dev
workflow_dispatch:

jobs:
Expand Down
24 changes: 13 additions & 11 deletions R/mod_event_count.R → R/mod_hierarchical_count_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ hierarchical_count_table_ui <- function(id) {
#'
#' @export
hierarchical_count_table_server <- function(
# nolint
id,
table_dataset,
pop_dataset,
Expand Down Expand Up @@ -608,16 +609,16 @@ hierarchical_count_table_server <- function(
#'
#' @export
mod_hierarchical_count_table <- function(module_id,
table_dataset_name,
pop_dataset_name,
subjid_var = "USUBJID",
show_modal_on_click = FALSE,
default_hierarchy = NULL,
default_group = NULL,
table_dataset_disp,
pop_dataset_disp,
receiver_id = NULL,
server_wrapper_func = identity) {
table_dataset_name,
pop_dataset_name,
subjid_var = "USUBJID",
show_modal_on_click = FALSE,
default_hierarchy = NULL,
default_group = NULL,
table_dataset_disp,
pop_dataset_disp,
receiver_id = NULL,
server_wrapper_func = identity) {
if (!missing(table_dataset_name) && !missing(table_dataset_disp)) {
rlang::abort("`table_dataset_name` and `table_dataset_disp` cannot be used at the same time, use one or the other")
}
Expand Down Expand Up @@ -669,6 +670,7 @@ mod_hierarchical_count_table <- function(module_id,
#' @export

mock_app_hierarchical_count_table <- function(
# nolint
dry_run = FALSE,
update_query_string = TRUE,
srv_defaults = list(),
Expand Down Expand Up @@ -714,7 +716,7 @@ mock_app_hierarchical_count_table <- function(
#' Mock hierarchy table app in dv.manager
#' @keywords mock
#' @export
mock_app_hierarchical_count_table_mm <- function() {
mock_app_hierarchical_count_table_mm <- function() { # nolint
if (!requireNamespace("dv.manager")) {
stop("Install dv.manager")
}
Expand Down
22 changes: 0 additions & 22 deletions tests/testthat/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,27 +60,5 @@ start_app_driver <- function(expr) {
root_app
}

# SVG EXPECTATION
# When an error occurs over an r2d3 svg it is not neccesarily removed from the DOM but its visibility is hidden, therefore if we expect the graph
# we expect that it is there, that it is visible and that there are no errors inside the container.
expect_r2d3_svg <- function(app, query_list) {
purrr::walk(query_list, function(query) {
# Check there is an SVG
svg_vec <- rvest::read_html(app$get_js(query[["svg"]])) %>%
rvest::html_elements("svg")
expect_length(svg_vec, query[["n"]])

# Check that is visible
is_hidden <- rvest::read_html(app$get_html(query[["container"]])) %>%
rvest::html_element("div .r2d3") %>%
rvest::html_attr("style") %>%
stringr::str_detect("visibility: hidden;")
expect_false(is_hidden)

# Check that there is no error inside the div
error_vec <- rvest::read_html(app$get_html(query[["container"]])) %>%
rvest::html_element("div .shiny-output-error")
expect_length(error_vec, 0)
})
}
# nolint end
6 changes: 5 additions & 1 deletion tests/testthat/test-event_count.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ local({

test_that("counting is correct, sorting, against (snapshot)" |>
vdoc[["add_spec"]](
c(specs$hierarchical_count_table$event_count, specs$hierarchical_count_table$event_count_display, specs$hierarchical_count_table$sorted_table_display)
c(
specs$hierarchical_count_table$event_count,
specs$hierarchical_count_table$event_count_display,
specs$hierarchical_count_table$sorted_table_display
)
), {
expect_snapshot(x)
})
Expand Down
21 changes: 0 additions & 21 deletions vignettes/_common/_info.Rmd

This file was deleted.

File renamed without changes.
File renamed without changes

0 comments on commit 4122a45

Please sign in to comment.