Skip to content

Commit

Permalink
add levels to test
Browse files Browse the repository at this point in the history
  • Loading branch information
boshek committed Dec 16, 2024
1 parent 4c6671c commit dd4d927
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions tests/testthat/test-historical-webservice.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
test_that("historical_ws returns the correct data header", {
test_that("ws_daily_flows returns the correct data header", {
skip_on_cran()

ws_test <- ws_daily_flows(station_number = "08MF005")
Expand All @@ -9,20 +9,39 @@ test_that("historical_ws returns the correct data header", {
"STATION_NUMBER", "Date", "Parameter", "Value", "Symbol"
)
)

## Turned #42 into a test
expect_true(is.numeric(ws_test$Value))
})


test_that("historical_ws is empty is a nearish date", {
test_that("ws_daily_flows is empty with a nearish date", {
skip_on_cran()

expect_error(ws_daily_flows(
station_number = "08MF005",
start_date = Sys.Date() - 2
), "No data exists for this station query during the period chosen")

})

test_that("ws_daily_levels returns the correct data header", {
skip_on_cran()

ws_test <- ws_daily_levels(station_number = "08MF005")

expect_identical(
colnames(ws_test),
c(
"STATION_NUMBER", "Date", "Parameter", "Value", "Symbol"
)
)
expect_true(is.numeric(ws_test$Value))
})


test_that("ws_daily_levels is empty with a nearish date", {
skip_on_cran()

expect_error(ws_daily_levels(
station_number = "08MF005",
start_date = Sys.Date() - 2
), "No data exists for this station query during the period chosen")
})

0 comments on commit dd4d927

Please sign in to comment.