Skip to content

Commit 056c98c

Browse files
committed
Update tests
1 parent 796853f commit 056c98c

File tree

2 files changed

+30
-21
lines changed

2 files changed

+30
-21
lines changed

tests/testthat.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
library(testthat)
2+
library(httr)
23
library(isoWater)
34

45
test_check("isoWater")

tests/testthat/test-wiDB.R

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
1-
p = wiDB_values("projects")
2-
3-
test_that("wiDB_values works", {
4-
expect_type(p, "list")
5-
expect_length(p, 1)
6-
})
7-
8-
p = wiDB_sites(minDate = "2020-09-01", types = "Tap")
9-
10-
test_that("wiDB_sites works", {
11-
expect_s3_class(p, "data.frame")
12-
expect_gte(nrow(p), 2)
13-
})
14-
15-
p = wiDB_data(minDate = "1990-01-01", maxDate = "1990-02-01",
16-
countries = "US", types = "Precipitation")
17-
18-
test_that("wiDB_data works", {
19-
expect_type(p, "list")
20-
expect_length(p, 2)
21-
})
1+
if(curl::has_internet()){
2+
p = wiDB_values("projects")
3+
4+
if(!is.null(p)){
5+
test_that("wiDB_values works", {
6+
expect_type(p, "list")
7+
expect_length(p, 1)
8+
})
9+
}
10+
11+
p = wiDB_sites(minDate = "2020-09-01", types = "Tap")
12+
13+
if(!is.null(p)){
14+
test_that("wiDB_sites works", {
15+
expect_s3_class(p, "data.frame")
16+
expect_gte(nrow(p), 2)
17+
})
18+
}
19+
20+
p = wiDB_data(minDate = "1990-01-01", maxDate = "1990-02-01",
21+
countries = "US", types = "Precipitation")
22+
23+
if(!is.null(p)){
24+
test_that("wiDB_data works", {
25+
expect_type(p, "list")
26+
expect_length(p, 2)
27+
})
28+
}
29+
}

0 commit comments

Comments
 (0)