From e0760dcea8490d66f8aabafe5ffc775e508aeaa9 Mon Sep 17 00:00:00 2001 From: "alex.hill@gmail.com" Date: Thu, 26 Sep 2024 15:58:51 +0100 Subject: [PATCH] fix test --- R/router.R | 2 +- tests/testthat/test-router.R | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/R/router.R b/R/router.R index 0f69f37..a2db984 100644 --- a/R/router.R +++ b/R/router.R @@ -54,7 +54,7 @@ build_routes <- function(cookie_key = plumber::random_cookie_key(), package = "serovizr")), eval.expr = FALSE) pr$setApiSpec(api) - require(redoc) + library(redoc) pr$setDocs("redoc") pr$mount("/schema", plumber::PlumberStatic$new(file.path(system.file("schema", package = "serovizr")))) diff --git a/tests/testthat/test-router.R b/tests/testthat/test-router.R index 8577e7e..9ef95b3 100644 --- a/tests/testthat/test-router.R +++ b/tests/testthat/test-router.R @@ -58,12 +58,13 @@ test_that("DELETE /dataset", { expect_equal(body$data, "testdataset") }) -test_that("DELETE /dataset returns 404 if not found", { +test_that("DELETE /dataset returns 200 if dataset doesn't exist", { router <- build_routes(cookie_key) res <- router$call(make_req("DELETE", "/dataset/testdataset/", HTTP_COOKIE = cookie)) - expect_equal(res$status, 404) + expect_equal(res$status, 200) + expect_equal(body$data, "testdataset") }) test_that("GET /datasets", {