Skip to content

Commit

Permalink
feat: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nahid18 committed Oct 12, 2023
1 parent 840c8d1 commit 985aadf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 48 deletions.
2 changes: 1 addition & 1 deletion 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(
Expand Down
4 changes: 2 additions & 2 deletions README.Rmd
Expand Up @@ -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,
<https://github.com/nahid18/easylift>.


Expand All @@ -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},
}
```
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -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,
<https://github.com/nahid18/easylift>.

A BibTeX entry for LaTeX users is
Expand All @@ -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},
}

Expand Down
48 changes: 5 additions & 43 deletions tests/testthat/test-easylift.R
Expand Up @@ -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"))
Expand Down

0 comments on commit 985aadf

Please sign in to comment.