Skip to content

Commit 5811023

Browse files
committed
Skip snapshots on mac and windows
1 parent 2d9d378 commit 5811023

2 files changed

Lines changed: 30 additions & 8 deletions

File tree

R/test_utils.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ expect_snapshot_leaflet <- function(map) {
22
saveRDS(map, "test.rds")
33
testthat::expect_snapshot_file("test.rds")
44
}
5+
6+
7+
system_os <- function() {
8+
tolower(Sys.info()[["sysname"]])
9+
}

tests/testthat/test_c05_map_leaflet.R

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
test_that("maps_leaflet_base return maps", {
22
skip_on_cran()
3+
skip_on_os(c("windows", "mac"))
34

45
expect_silent(
56
map <- map_leaflet_base(
@@ -11,34 +12,44 @@ test_that("maps_leaflet_base return maps", {
1112
attr(map$x, "leafletData"),
1213
unique(finches[, c("logger_id", "lat", "lon")])
1314
)
15+
16+
skip_on_os(c("windows", "mac"))
1417
expect_snapshot_value(deparse(map$x), style = "json2")
1518
})
1619

17-
test_that("map_leaflet() returns summary map", {
20+
test_that("map_leaflet() returns sum", {
1821
skip_on_cran()
1922

20-
expect_error(
23+
expect_silent(
2124
map <- map_leaflet(
2225
p = presence(visits(finches)),
2326
m = move(visits(finches)),
2427
summary = "sum"
25-
),
26-
NA
28+
)
2729
)
2830
expect_s3_class(map, c("leaflet", "htmlwidget"))
31+
32+
skip_on_os(c("windows", "mac"))
2933
expect_snapshot_value(deparse(map$x), style = "json2")
34+
})
3035

31-
expect_error(
36+
test_that("map_leaflet() returns sum_indiv", {
37+
skip_on_cran()
38+
expect_silent(
3239
map <- map_leaflet(
3340
p = presence(visits(finches)),
3441
m = move(visits(finches)),
3542
summary = "sum_indiv"
36-
),
37-
NA
43+
)
3844
)
3945
expect_s3_class(map, c("leaflet", "htmlwidget"))
46+
47+
skip_on_os(c("windows", "mac"))
4048
expect_snapshot_value(deparse(map$x), style = "json2")
49+
})
4150

51+
test_that("map_leaflet() returns pre-summarized", {
52+
skip_on_cran()
4253
p2 <- presence(visits(finches)) %>%
4354
dplyr::group_by(logger_id, lat, lon) %>%
4455
dplyr::summarize(amount = sum(length) / logger_n[1], .groups = "drop")
@@ -52,6 +63,8 @@ test_that("map_leaflet() returns summary map", {
5263

5364
expect_error(map <- map_leaflet(p = p2, m = m2), NA)
5465
expect_s3_class(map, c("leaflet", "htmlwidget"))
66+
67+
skip_on_os(c("windows", "mac"))
5568
expect_snapshot_value(deparse(map$x), style = "json2")
5669
})
5770

@@ -67,7 +80,9 @@ test_that("map_leaflet() returns summary map of individuals", {
6780

6881
expect_error(map <- map_leaflet(p = p_indiv, m = m_indiv), NA)
6982
expect_s3_class(map, c("leaflet", "htmlwidget"))
70-
expect_snapshot_value(deparse(map$x), style = "json2")
83+
84+
skip_on_os(c("windows", "mac"))
85+
expect_snapshot_value(deparse(map$x), style = "json2", variant = )
7186
})
7287

7388
test_that("map_leaflet() scale, pal, title", {
@@ -88,5 +103,7 @@ test_that("map_leaflet() scale, pal, title", {
88103
NA
89104
)
90105
expect_s3_class(map, c("leaflet", "htmlwidget"))
106+
107+
skip_on_os(c("windows", "mac"))
91108
expect_snapshot_value(deparse(map$x), style = "json2")
92109
})

0 commit comments

Comments
 (0)