mirror of
https://github.com/sensebox/opensensmapr
synced 2025-02-20 20:23:58 +01:00
increase test coverage
This commit is contained in:
parent
5f6dc7c0b5
commit
d82b538b7a
3 changed files with 12 additions and 2 deletions
|
@ -106,8 +106,9 @@ parse_get_measurements_params = function (params) {
|
|||
if (is.null(params$phenomenon) | is.na(params$phenomenon))
|
||||
stop('Parameter "phenomenon" is required')
|
||||
|
||||
if (!is.na(params$from) && is.na(params$to))
|
||||
stop('specify "from" only together with "to"')
|
||||
if ((!is.na(params$from) && is.na(params$to)) ||
|
||||
(!is.na(params$to) && is.na(params$from))
|
||||
) stop('specify "from" only together with "to"')
|
||||
|
||||
if (
|
||||
(!is.null(params$bbox) && !is.null(params$boxes)) ||
|
||||
|
|
|
@ -17,6 +17,11 @@ test_that("a list of all boxes can be retrieved and returns a sensebox data.fram
|
|||
expect_true(any("sensebox" %in% class(boxes)))
|
||||
})
|
||||
|
||||
test_that("both from and to are required when requesting boxes, error otherwise", {
|
||||
expect_error(osem_boxes(from = as.POSIXct("2017-01-01")), "must be used together")
|
||||
expect_error(osem_boxes(to = as.POSIXct("2017-01-01")), "must be used together")
|
||||
})
|
||||
|
||||
test_that("a list of boxes with exposure filter returns only the requested exposure", {
|
||||
check_api()
|
||||
|
||||
|
|
|
@ -91,3 +91,7 @@ test_that("measurements can be retrieved for a time period", {
|
|||
expect_true(all(measurements$createdAt > from_date))
|
||||
})
|
||||
|
||||
test_that("both from and to are required when requesting measurements, error otherwise", {
|
||||
expect_error(osem_measurements(x = "Temperature", from = as.POSIXct("2017-01-01")), "only together with")
|
||||
expect_error(osem_measurements(x = "Temperature", to = as.POSIXct("2017-01-01")), "only together with")
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue