tests/testthat/test_new_feature_results.R

context("new_feature_results")

test_that("initialization", {
  # create object
  d <- new_dataset_from_auto(import_simple_raster_data())
  v <- new_variable_from_auto(dataset = d, index = 1, units = "ha")
  f <- new_feature(
    name = "Intact Alvar",
    variable = v,
    visible = FALSE,
    status = FALSE,
    goal = 0.2,
    limit_goal = 0.2,
    current = 0.56,
    id = "FID1"
  )
  x <- new_feature_results(
    feature = f,
    held = 0.9,
    id = "RID1"
  )
  # run tests
  print(x)
  expect_is(x$repr(), "character")
  expect_identical(x$id, "RID1")
  expect_identical(x$status, FALSE)
  expect_identical(x$goal, 0.2)
  expect_identical(x$held, 0.9)
})
NCC-CNC/wheretowork documentation built on Feb. 27, 2025, 6:11 p.m.