diff --git a/R/fetchSCAN.R b/R/fetchSCAN.R index c7e3f6c1..7fe86842 100644 --- a/R/fetchSCAN.R +++ b/R/fetchSCAN.R @@ -124,11 +124,9 @@ fetchSCAN <- function(site.code = NULL, year = NULL, report = 'SCAN', timeseries res <- list() # add metadata from cached table in soilDB + # note row-order may not match ordering in site.code m <- SCAN_site_metadata(site.code) - # why do this? - site.code <- m$Site - # all possible combinations of site codes and year | single report and timeseries type g <- expand.grid(s = site.code, y = year, r = report, dt = timeseries) diff --git a/tests/testthat/test-fetchSCAN.R b/tests/testthat/test-fetchSCAN.R index 34124a31..adb463fb 100644 --- a/tests/testthat/test-fetchSCAN.R +++ b/tests/testthat/test-fetchSCAN.R @@ -20,8 +20,8 @@ test_that("fetchSCAN() works", { # completely empty request for valid site (bogus year) y <<- fetchSCAN(site.code = 2072, year = 1800) - # multiple sites / years - z <<- fetchSCAN(site.code = c(356, 2072), year = c(2015, 2016)) + # multiple sites / years / time zones (GMT-8, GMT-5) + z <<- fetchSCAN(site.code = c(2218, 2005), year = c(2015, 2016)) }) @@ -53,3 +53,18 @@ test_that("fetchSCAN() returns the right kind of data", { expect_true(inherits(y$SMS, 'data.frame')) expect_true(ncol(y$SMS) == 9) }) + +test_that("timezone check", { + + skip_if_offline() + + skip_on_cran() + + # skip on error + # skip on error + skip_if(inherits(x, 'try-error') || is.null(x)) + + # should be GMT-8, that of the first station (2218) + .tz <- table(format(z$SMS$datetime, format = '%Z')) + expect_true(names(.tz) == '-08') +})