Skip to content

Commit

Permalink
Also test fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
sverhoeven committed Oct 14, 2024
1 parent e39fdda commit f6868ee
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion R/remotebmi/tests/testthat/test-route.R
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ mock_model <- list(

route <- create_route(mock_model)
formatter <- reqres::format_json(auto_unbox = TRUE)
formatter_plain <- reqres::format_json()

test_that("/get_component_name", {
fake_rook <- fiery::fake_request("/get_component_name")
Expand Down Expand Up @@ -549,3 +548,12 @@ test_that("/get_grid_nodes_per_face", {
expect_equal(res$body, formatter(c(4, 4, 3)))
expect_equal(method_called_with[["get_grid_nodes_per_face"]], "1")
})

test_that("fallback route", {
fake_rook <- fiery::fake_request("/random_url_is_not_found")
req <- reqres::Request$new(fake_rook)
res <- req$respond()
route$dispatch(req)
expect_equal(res$status, 404)
expect_equal(res$body, "Not found")
})

0 comments on commit f6868ee

Please sign in to comment.