Skip tests that require internet if offline
Change-Id: I679362d9d3595c8212c20d2086d92afcbd58d13f
diff --git a/tests/testthat/test-demos.R b/tests/testthat/test-demos.R
index c0412ba..b51a4cd 100644
--- a/tests/testthat/test-demos.R
+++ b/tests/testthat/test-demos.R
@@ -1,4 +1,5 @@
test_that("Alternatives over time highcharter example works", {
+ skip_if_offline()
year <- c(2013:2018)
alternatives <- c("macht []{0,3} Sinn", "ergibt []{0,3} Sinn")
hc <- new("KorAPConnection", verbose = TRUE) %>%
@@ -12,6 +13,7 @@
})
test_that("Multiple queries over time highcharter example works", {
+ skip_if_offline()
year <- c(2013:2018)
alternatives <- c("macht []{0,3} Sinn", "ergibt []{0,3} Sinn")
@@ -26,6 +28,7 @@
})
test_that("Single query in multiple over time highcharter example works", {
+ skip_if_offline()
year <- c(2013:2018)
alternatives <- c("macht []{0,3} Sinn", "ergibt []{0,3} Sinn")
@@ -40,6 +43,7 @@
})
test_that("Single query over time highcharter example works", {
+ skip_if_offline()
year <- c(2013:2018)
q <- c("macht []{0,3} Sinn")
@@ -54,6 +58,7 @@
})
test_that("Auto conditions over time highcharter example works", {
+ skip_if_offline()
kco <- new("KorAPConnection", verbose=TRUE)
hc <- expand_grid(
myconditions = c("textDomain = /Wirtschaft.*/",
@@ -70,6 +75,7 @@
})
test_that("Single condition over time highcharter example works", {
+ skip_if_offline()
kco <- new("KorAPConnection", verbose=TRUE)
hc <- expand_grid(
condition = c("textDomain = /Wirtschaft.*/"),
@@ -85,6 +91,7 @@
})
test_that("Multiple conditions over time highcharter example works", {
+ skip_if_offline()
kco <- new("KorAPConnection", verbose=TRUE)
hc <- expand_grid(
condition = c("textDomain = /Wirtschaft.*/",
@@ -101,6 +108,7 @@
})
test_that("Multiple conditions and queries over time highcharter example works", {
+ skip_if_offline()
kco <- new("KorAPConnection", verbose=TRUE)
hc <- expand_grid(
qx = c("[tt/l=Heuschrecke]", "Ameise"),
@@ -117,7 +125,8 @@
expect_true(all(class(hc) %in% c("highchart", "htmlwidget")))
})
-test_that("collocationScoreQuery works iwth hchart and hc_add_onclick_korap_search", {
+test_that("collocationScoreQuery works with hchart and hc_add_onclick_korap_search", {
+ skip_if_offline()
kco <- new("KorAPConnection", cache = TRUE, verbose = TRUE)
df <- collocationScoreQuery(kco,"Ameisenplage", "heimgesucht", leftContextSize=0, rightContextSize=1)
hc <- hchart(df, type="spline", hcaes(label, logDice))