-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: added a formatting function for the output of data_extract_srv
#60
Conversation
Code Coverage Summary
Results for commit: 988dc88 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#' } | ||
#' @export | ||
#' | ||
format_data_extract <- function(data_extract) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could imagine this being called in a reactive context so maybe we should not have the assert and stop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then, the reactive caller should catch the error and rethrow a shiny::validate error. This function does not know about shiny
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True - though in practice that will never be done of course.
This function will be being called when the add_to_report button is pressed so there's unlikely to be some weird initialization issue where this function is being called maybe with DDL where data_extract is say NULL? I get very confused as to the sequence of events during load up. You could imagine adding a if(is.null(data_exrtract)) return NULL or some such thing to make people lives a little easier if needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a guard statement for null
select = select_spec(choices = c("Petal.Length", "Species")) | ||
) | ||
|
||
shiny::testServer( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's not ideal because data_extract_srv does not output the structure with all values filled but just a skeleton due to the use of js for some logic.
A proper test boots up a headless browser for this, which I am keen on doing.
Co-authored-by: Nikolas Burkoff <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}) | ||
|
||
testthat::test_that("format_data_extract integrates with data_extract_srv and the filtered data object", { | ||
skip_if_too_deep(4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 4
our convention for these tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's a convention. This file takes around 10% of the whole test-suite duration, and most of it can be attributed to this particular test. I think it's unreasonable to run it always.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
happy to not always run it - in other places (tmh?)I think we use 5 not 4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving, will let you decide what to do with the browser test
Oh crap. It was on auto merge, grr. I will open a new PR to fix the headless browser test |
Related to insightsengineering/teal.reporter#8