From 3708600c18dd80ffa367f61b1942a827ecc624b7 Mon Sep 17 00:00:00 2001 From: Andy Date: Sat, 4 May 2024 09:47:20 -0600 Subject: [PATCH] use testthat and add test --- DESCRIPTION | 3 +++ tests/testthat.R | 12 ++++++++++++ tests/testthat/test-get_api_request.R | 3 +++ 3 files changed, 18 insertions(+) create mode 100644 tests/testthat.R create mode 100644 tests/testthat/test-get_api_request.R diff --git a/DESCRIPTION b/DESCRIPTION index 8bb9720..17141eb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -15,3 +15,6 @@ Imports: httr, jsonlite, stringr +Suggests: + testthat (>= 3.0.0) +Config/testthat/edition: 3 diff --git a/tests/testthat.R b/tests/testthat.R new file mode 100644 index 0000000..19673e6 --- /dev/null +++ b/tests/testthat.R @@ -0,0 +1,12 @@ +# This file is part of the standard setup for testthat. +# It is recommended that you do not modify it. +# +# Where should you do additional test configuration? +# Learn more about the roles of various files in: +# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview +# * https://testthat.r-lib.org/articles/special-files.html + +library(testthat) +library(emberr) + +test_check("emberr") diff --git a/tests/testthat/test-get_api_request.R b/tests/testthat/test-get_api_request.R new file mode 100644 index 0000000..922af81 --- /dev/null +++ b/tests/testthat/test-get_api_request.R @@ -0,0 +1,3 @@ +test_that("bad url throws error", { + expect_error(get_api_request(query_url = "foo")) +})