-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add initial tests for the support_panel function #5
Conversation
This reverts commit e2b5686.
The workflow I think we should set up is the general R CMD check, that runs the tests amongst other things rather than just having one for our automated tests. Happy to add that here or in a separate branch with other workflows? |
Merge remote-tracking branch 'origin/cookie-module' into add-initial-tests # Conflicts: # DESCRIPTION # R/standard_panels.R # README.md # man/support_panel.Rd
#' @param input_cookies The cookie input passed from cookies.js (should always | ||
#' be reactive(input$cookies)) | ||
#' @param input_clear The state of the cookie reset button provided by | ||
#' dfeshiny::support_panel(). Should always be set to reactive(input$cookie_consent_clear). |
Check notice
Code scanning / lintr
Lines should not be more than 80 characters. This line is 91 characters. Note
@@ -0,0 +1,9 @@ | |||
server <- function(input, output, session) { | |||
output$cookie_status <- cookie_banner_server( |
Check warning
Code scanning / lintr
no visible global function definition for 'cookie_banner_server' Warning test
server <- function(input, output, session) { | ||
output$cookie_status <- cookie_banner_server( | ||
"cookies", | ||
input_cookies = reactive(input$cookies), |
Check warning
Code scanning / lintr
no visible global function definition for 'reactive' Warning test
server <- function(input, output, session) { | ||
output$cookie_status <- cookie_banner_server( | ||
"cookies", | ||
input_cookies = reactive(input$cookies), |
Check warning
Code scanning / lintr
no visible global function definition for 'reactive' Warning test
input_cookies = reactive(input$cookies), | ||
input_clear = reactive(input$cookie_consent_clear), | ||
parent_session = session, | ||
google_analytics_key = google_analytics_key |
Check warning
Code scanning / lintr
no visible binding for global variable 'google_analytics_key' Warning test
id = "navlistPanel", | ||
widths = c(2, 8), | ||
well = FALSE, | ||
support_panel( |
Check warning
Code scanning / lintr
no visible global function definition for 'support_panel' Warning test
#' @export | ||
#' | ||
#' @examples | ||
#' # To use the banner, first copy the file cookie-consent.js from the js/ folder |
Check notice
Code scanning / lintr
Lines should not be more than 80 characters. This line is 81 characters. Note
#' dfe_cookie_script() | ||
#' cookie_banner_ui("cookies", name = "My DfE R-Shiny data dashboard") | ||
#' | ||
#' # And add the following in server.R (after updating the google analytics key): |
Check notice
Code scanning / lintr
Lines should not be more than 80 characters. This line is 81 characters. Note
#' @export | ||
#' | ||
#' @examples | ||
#' # To use the banner, first copy the file cookie-consent.js from the js/ folder |
Check notice
Code scanning / lintr
Lines should not be more than 80 characters. This line is 81 characters. Note
#' dfe_cookie_script() | ||
#' cookie_banner_ui("cookies", name = "My DfE R-Shiny data dashboard") | ||
#' | ||
#' # And add the following in server.R (after updating the google analytics key): |
Check notice
Code scanning / lintr
Lines should not be more than 80 characters. This line is 81 characters. Note
Closing in favour of a new PR |
These are the first unit tests we've added so hopefully lay an example for how to add them.
Added basic validation (can be improved in future!) to the team_email argument in the support_panel() function.
I used usethis::use_test("support-panel") to set up the scripts for tests and then added a few simple test case emails in there for ones that should pass, and ones that should trigger the stop message.
Edit:
This adds R CMD Check as a way to run the tests and test the package more widely using github actions. This also adds a code coverage action using https://app.codecov.io/. That will likely only start running once this branch is merged into main