From 985aadfd9ec5284b066f67707ea251f36f58d8ef Mon Sep 17 00:00:00 2001 From: nahid18 Date: Thu, 12 Oct 2023 15:12:25 +0600 Subject: [PATCH] feat: fix tests --- DESCRIPTION | 2 +- README.Rmd | 4 +-- README.md | 4 +-- tests/testthat/test-easylift.R | 48 ++++------------------------------ 4 files changed, 10 insertions(+), 48 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index bb4967d..644bf93 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: easylift Title: An R package to perform genomic liftover -Version: 0.99.98 +Version: 0.99.99 Date: 2023-10-12 Authors@R: c( diff --git a/README.Rmd b/README.Rmd index eeb63bb..e6fe094 100644 --- a/README.Rmd +++ b/README.Rmd @@ -87,7 +87,7 @@ gr |> easylift("hg38") To cite package `easylift` in publications use: Al Nahid A, Pagès H, Love M (2023). _easylift: An R package to perform - genomic liftover_. R package version 0.99.98, + genomic liftover_. R package version 0.99.99, . @@ -98,7 +98,7 @@ A BibTeX entry for LaTeX users is title = {easylift: An R package to perform genomic liftover}, author = {Abdullah Al Nahid, Hervé Pagès, Michael Love}, year = {2023}, - note = {R package version 0.99.98}, + note = {R package version 0.99.99}, url = {https://github.com/nahid18/easylift}, } ``` diff --git a/README.md b/README.md index c484505..7cfdaf5 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ gr |> easylift("hg38") To cite package `easylift` in publications use: Al Nahid A, Pagès H, Love M (2023). *easylift: An R package to perform -genomic liftover*. R package version 0.99.98, +genomic liftover*. R package version 0.99.99, . A BibTeX entry for LaTeX users is @@ -93,7 +93,7 @@ A BibTeX entry for LaTeX users is title = {easylift: An R package to perform genomic liftover}, author = {Abdullah Al Nahid, Hervé Pagès, Michael Love}, year = {2023}, - note = {R package version 0.99.98}, + note = {R package version 0.99.99}, url = {https://github.com/nahid18/easylift}, } diff --git a/tests/testthat/test-easylift.R b/tests/testthat/test-easylift.R index 410a781..7c51156 100644 --- a/tests/testthat/test-easylift.R +++ b/tests/testthat/test-easylift.R @@ -97,53 +97,15 @@ test_that("easylift succeeds with BiocFileCache", { expect_error(easylift(gr, "hg38", bfc)) expect_error(gr |> easylift("hg38", bfc)) + expect_no_error(easylift(gr, "hg38", NULL, bfc)) expect_no_error(gr |> easylift("hg38", NULL, NULL)) expect_no_error(gr |> easylift("hg38", NULL)) - # Test success when bfc is provided - tryCatch({ - result <- easylift(x = gr, to = "hg38", bfc = bfc) - }, error = function(e) { - cat("Error message:", conditionMessage(e), "\n") - stop("easylift encountered an error.") - }) - - expect_true(!is(result, "try-error"), - "easylift should succeed without error.") - - # Test success when bfc is NULL - tryCatch({ - result2 <- easylift(x = gr, to = "hg38", bfc = NULL) - }, error = function(e) { - cat("Error message:", conditionMessage(e), "\n") - stop("easylift encountered an error.") - }) - - expect_true(!is(result2, "try-error"), - "easylift should succeed without error.") - - # Test success when chain is NULL - tryCatch({ - result3 <- easylift(x = gr, to = "hg38", chain = NULL) - }, error = function(e) { - cat("Error message:", conditionMessage(e), "\n") - stop("easylift encountered an error.") - }) - - expect_true(!is(result3, "try-error"), - "easylift should succeed without error.") - - # Test success when both bfc and chain are NULL - tryCatch({ - result4 <- easylift(x = gr, to = "hg38", chain = NULL, bfc = NULL) - }, error = function(e) { - cat("Error message:", conditionMessage(e), "\n") - stop("easylift encountered an error.") - }) - - expect_true(!is(result4, "try-error"), - "easylift should succeed without error.") + expect_no_error(easylift(x = gr, to = "hg38", bfc = bfc)) + expect_no_error(easylift(x = gr, to = "hg38", bfc = NULL)) + expect_no_error(easylift(x = gr, to = "hg38", chain = NULL)) + expect_no_error(easylift(x = gr, to = "hg38", chain = NULL, bfc = NULL)) # Test error when provided bfc is not a BiocFileCache instance expect_error(easylift(x = gr, to = "hg38", bfc = "bfc"))