tests/testthat/test-set_boundaries.R

test_that("region", {
  
  x <- list(boundaries = NULL)
  region <- data.frame(geometry = "test")
  
  expect_error(set_boundaries(x, region = region))
  
  class(region) <- c("sf")
  
  expect_no_error(x <- set_boundaries(x, region = region))
  
  expect_equal(x$boundaries$region, region)
  expect_null(x$boundaries$group)
  
})

test_that("group", {
  
  x <- list(boundaries = NULL)
  group <- data.frame(geometry = "test")
  
  expect_error(set_boundaries(x, group = group))
  
  class(group) <- c("sf")
  
  expect_no_error(x <- set_boundaries(x, group = group))
  
  expect_null(x$boundaries$region)
  expect_equal(x$boundaries$group, group)
  
})

Try the GeoTox package in your browser

Any scripts or data that you put into this service are public.

GeoTox documentation built on April 4, 2025, 5:07 a.m.