1
0
Fork 0
mirror of https://github.com/sensebox/opensensmapr synced 2025-02-23 16:23:58 +01:00

add first test for measurements

This commit is contained in:
nuest 2018-01-14 22:14:12 +01:00
parent 8e1fb7ad10
commit 9a81816922

View file

@ -0,0 +1,25 @@
context("measurements")
check_api <- function() {
code <- NA
try(code <- httr::status_code(httr::GET(osem_endpoint())))
if (is.na(code)) skip("API not available")
}
try({
boxes <- osem_boxes()
})
test_that("measurements of specific boxes can be retrieved for one phenomenon and returns a measurements data.frame", {
check_api()
# fix for subsetting
class(boxes) <- c("data.frame")
three_boxes <- boxes[1:3,]
three_boxes <- osem_as_sensebox(three_boxes)
phens <- names(osem_phenomena(three_boxes))
measurements <- osem_measurements(x = three_boxes, phenomenon = phens[[1]])
expect_true(is.data.frame(measurements))
expect_true("osem_measurements" %in% class(measurements))
})