test_that("weather observation works", {
# Set dummy key
set_key("dummy_api_key")
# Load package example data
data(poi)
# Test with API response mock
with_mocked_bindings(
.async_request = function(url, rps) {
hereR:::mock$weather_observation_response
},
{
weather_observation <- weather(poi = poi, product = "observation")
# Tests
expect_equal(any(sf::st_geometry_type(weather_observation) != "POINT"), FALSE)
expect_equal(length(unique(weather_observation$id)), nrow(poi))
}
)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.