tests/testthat/test_source_annotations.R

context('Sourcing annotations')


test_that("Environment with annotation functions are returned.",{
  anno_path <- spekex::get_annotations_path('sham')

  result <- source_annotations(anno_path)
  expect_type(result, "environment")

  names_begin_with_annotate <- grepl("^annotate", names(result))
  expect_true(any(names_begin_with_annotate))
})

test_that("Returns empty environment if path is missing.", {
  result <- source_annotations(NULL)
  expect_type(result, "environment")
  expect_identical(ls(result), character(0))
})

test_that("Emits error if path to environment is invalid.", {
  anno_path <- system.file("not","extant")
  expect_error(source_annotations(anno_path), regexp=BS$ERROR_INVALID_ANNOTATION_PATH, fixed=TRUE)
})
Display-Lab/bit-stomach documentation built on Dec. 12, 2021, 1:35 a.m.