Skip to content

Commit

Permalink
Add additional tests for get_file_path (#808)
Browse files Browse the repository at this point in the history
* Add additional tests for `get_file_path`

* Style code

---------

Co-authored-by: Moohan <[email protected]>
Co-authored-by: Jennit07 <[email protected]>
  • Loading branch information
3 people authored Sep 25, 2023
1 parent 04c2685 commit 9652c69
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/testthat/test-get_file_paths.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
test_that("Errors properly", {
expect_error(
get_file_path(directory = "foo", file_name = "bar"),
"The directory .+? does not exist\\."
)

expect_error(
get_file_path(
directory = ".",
file_name_regexp = "targets",
check_mode = "write"
),
"`check_mode = \"write\"` can't be used"
)
})

test_that("Can do check exists", {
expect_false(get_file_path(
directory = ".",
file_name = "foo.R",
check_mode = "exists"
))
})


skip_on_ci()

slf_updates_dir <- fs::path(
Expand Down

0 comments on commit 9652c69

Please sign in to comment.