add more package related function
This commit is contained in:
parent
bda91ce189
commit
f06b59e278
3 changed files with 34 additions and 0 deletions
|
|
@ -10,3 +10,6 @@ License: `use_mit_license()`, `use_gpl3_license()` or friends to pick a
|
|||
Encoding: UTF-8
|
||||
Roxygen: list(markdown = TRUE)
|
||||
RoxygenNote: 7.3.2
|
||||
Suggests:
|
||||
testthat (>= 3.0.0)
|
||||
Config/testthat/edition: 3
|
||||
|
|
|
|||
12
tests/testthat.R
Normal file
12
tests/testthat.R
Normal file
|
|
@ -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(beaumontmeteo)
|
||||
|
||||
test_check("beaumontmeteo")
|
||||
19
tests/testthat/test-getStationData.R
Normal file
19
tests/testthat/test-getStationData.R
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
library(jsonlite)
|
||||
library(httr)
|
||||
|
||||
|
||||
source(file.path(here::here(),"secrets"))
|
||||
# Create a Bearer token header
|
||||
headers.default <- add_headers(
|
||||
accept = "*/*",
|
||||
apikey = token2
|
||||
)
|
||||
|
||||
test_that("get station return something right",
|
||||
{
|
||||
test=getStationData(start_date="2024-06-24",end_date="2024-08-14",station_id="38269004",headers=headers.default)
|
||||
if(!is.null(test)){testthat::expect_length(test,3)}
|
||||
else testthat::expect_null(test)
|
||||
})
|
||||
|
||||
|
||||
Loading…
Reference in a new issue