Skip to content

Commit

Permalink
Fix suppressing check warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Ecnama committed Dec 2, 2024
1 parent cdf94d0 commit 30aae2c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/testthat/test-input.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,23 @@ test_that("synthesize_wishes throws error for non existing filière", {
# Testing parse_file

test_that("parse_file returns correct result for a valid input file", {
local_mock(read_file = function(file_path) read_file_output)
mockr::local_mock(read_file = function(file_path) read_file_output)
result <- parse_file("../data/test_file.xlsx")
expect_equal(result, parse_file_output)
})

test_that("parse_file throws error for invalid input file type", {
local_mock(read_file = function(file_path) stop("File type not supported"))
mockr::local_mock(read_file = function(file_path) stop("File type not supported"))
expect_error(parse_file("../data/test_file.csv"), "Error while reading the file : File type not supported")
})

test_that("parse_file throws error for non existent file", {
local_mock(read_file = function(file_path) stop("File does not exist"))
mockr::local_mock(read_file = function(file_path) stop("File does not exist"))
expect_error(parse_file("../data/imaginary_file.xlsx"), "Error while reading the file : File does not exist")
})

test_that("parse_file throws error for invalid data", {
local_mock(
mockr::local_mock(
read_file = function(file_path) read_file_output_invalid,
synthesize_wishes = function(wishes) stop("Unknown filière")
)
Expand Down

0 comments on commit 30aae2c

Please sign in to comment.