Skip to content
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

Closes #96 general issue increase test coverage for dataset_vignette.R #120

Merged

Conversation

zdz2101
Copy link
Collaborator

@zdz2101 zdz2101 commented Oct 12, 2022

Thank you for your Pull Request! We have developed this task checklist from the Development Process Guide to help with the final steps of the process. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the admiral codebase remains robust and consistent.

Please check off each taskbox as an acknowledgment that you completed the task or check off that it is not relevant to your Pull Request. This checklist is part of the Github Action workflows and the Pull Request will not be merged into the devel branch until you have checked off each task.

  • Place Closes #<insert_issue_number> into the beginning of your Pull Request Title (Use Edit button in top-right if you need to update)
  • Code is formatted according to the tidyverse style guide. Run styler::style_file() to style R and Rmd files
  • Updated relevant unit tests or have written new unit tests - See Unit Test Guide
  • If you removed/replaced any function and/or function parameters, did you fully follow the deprecation guidance?
  • Update to all relevant roxygen headers and examples.
  • Run devtools::document() so all .Rd files in the man folder and the NAMESPACE file in the project root are updated appropriately
  • Address any updates needed for vignettes and/or templates
  • Update NEWS.md if the changes pertain to a user-facing function (i.e. it has an @export tag) or documentation aimed at users (rather than developers)
  • Build admiral site pkgdown::build_site() and check that all affected examples are displayed correctly and that all new functions occur on the "Reference" page.
  • Address or fix all lintr warnings and errors - lintr::lint_package()
  • Run R CMD check locally and address all errors and warnings - devtools::check()
  • Link the issue so that it closes after successful merging.
  • Address all merge conflicts and resolve appropriately.
  • Pat yourself on the back for a job well done! Much love to your accomplishment!
    closes_issue96

@zdz2101 zdz2101 linked an issue Oct 12, 2022 that may be closed by this pull request
@github-actions
Copy link

github-actions bot commented Oct 12, 2022

Code Coverage

Package Line Rate Health
admiraldev 49%
Summary 49% (489 / 991)

test_that("dataset_vignette Test 1: a 'knitr_kable' object is output when run outside pkgdown", {
# dataset_vignette
## Test 1: A 'knitr_kable' object is output when run outside pkgdown ----
test_that("Test 1: A 'knitr_kable' object is output when run outside pkgdown", {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test_that("Test 1: A 'knitr_kable' object is output when run outside pkgdown", {
test_that("dataset_vignette Test 1: A 'knitr_kable' object is output when run outside pkgdown", {

We actually want it the other way. :) https://pharmaverse.github.io/admiraldev/devel/articles/unit_test_guidance.html#set-up-the-test-script
image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zdz2101 , you can easily achieve the correct formatting by calling the "format test_that test file" addin (see https://pharmaverse.github.io/admiraldev/devel/articles/unit_test_guidance.html#addin-admiraldevformat_test_that_file).

@@ -1,23 +1,34 @@
library(admiral.test)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this from the script

## Test 2: a 'datatables' object is output when run inside pkgdown ----
test_that("dataset_vignette Test 2: a 'datatables' object is output when run inside pkgdown", {
## Test 2: A 'datatables' object is output when run inside pkgdown ----
test_that("Test 2: A 'datatables' object is output when run inside pkgdown", {
Sys.setenv(IN_PKGDOWN = "true")
on.exit(Sys.setenv(IN_PKGDOWN = ""))
expect_s3_class(dataset_vignette(head(admiral_dm)), "datatables")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also update the calls like this for test data? Or just make some simple dummy data and remove the dependency all together.

Suggested change
expect_s3_class(dataset_vignette(head(admiral_dm)), "datatables")
expect_s3_class(dataset_vignette(head(admiral.test::admiral_dm)), "datatables")

@bms63
Copy link
Collaborator

bms63 commented Oct 12, 2022

Thanks so much for doing your first PR. Day 2!! :)

@thomas-neitmann
Copy link
Collaborator

Great to see your first PR @zdz2101! Sorry to be uber-nitpicky but in the future please use _ rather than - in the branch name. Thanks!

Comment on lines 37 to 38
## Test 3: An error is output when calling variable not in dataset ----
test_that("dataset_vignette Test 3: An error is output when calling variable not in dataset", {
Copy link
Collaborator

@bms63 bms63 Oct 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Test 3: An error is output when calling variable not in dataset ----
test_that("dataset_vignette Test 3: An error is output when calling variable not in dataset", {
## Test 3: An error is outputted when calling variable not in dataset ----
test_that("dataset_vignette Test 3: An error is outputted when calling variable not in dataset", {

Comment on lines 19 to 20
## Test 2: A 'datatables' object is output when run inside pkgdown ----
test_that("dataset_vignette Test 2: A 'datatables' object is output when run inside pkgdown", {
Copy link
Collaborator

@bms63 bms63 Oct 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Test 2: A 'datatables' object is output when run inside pkgdown ----
test_that("dataset_vignette Test 2: A 'datatables' object is output when run inside pkgdown", {
## Test 2: A 'datatables' object is outputted when run inside pkgdown ----
test_that("dataset_vignette Test 2: A 'datatables' object is outputted when run inside pkgdown", {

Comment on lines 2 to 3
## Test 1: A 'knitr_kable' object is output when run outside pkgdown ----
test_that("dataset_vignette Test 1: A 'knitr_kable' object is output when run outside pkgdown", {
Copy link
Collaborator

@bms63 bms63 Oct 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Test 1: A 'knitr_kable' object is output when run outside pkgdown ----
test_that("dataset_vignette Test 1: A 'knitr_kable' object is output when run outside pkgdown", {
## Test 1: A 'knitr_kable' object is outputted when run outside pkgdown ----
test_that("dataset_vignette Test 1: A 'knitr_kable' object is outputted when run outside pkgdown", {

Copy link
Collaborator

@bms63 bms63 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just some grammar stuff - i was not sure how to spell outputted.

@bms63
Copy link
Collaborator

bms63 commented Oct 13, 2022

Also best practice is to put the issue #96 in the commit message

https://pharmaverse.github.io/admiraldev/devel/articles/git_usage.html#commits-from-the-terminal-in-rstudio

@bms63 bms63 merged commit c78e0ef into devel Oct 13, 2022
@bms63 bms63 deleted the 96-general-issue-increase-test-coverage-for-dataset_vignetter branch October 13, 2022 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

General Issue: Increase test coverage for dataset_vignette.R
4 participants