I have written a package recently and I would like to test few functions where the functions delivers a data.frame when the input is correct, if not it delivers the input as a file into an error folder and logs into a log.log file.
Now the question is: How can i report this movement and do a test that the functions are moving the files into the error folder in test_that?
Thank you!
How about just calling your function with the incorrect input and afterwards checking if the error files were created as you wanted?
test_that("Error file is created", {
yourfunction(x)
expect_true(file.exists("errorfile.error")
})
Before yourfunction()
you also have to create your incorrect input x.