tests/testthat/test-distinct_input_select_years.R

context("Testing `distinct_input_select_years()`")

pkg_data <-
  system.file("extdata", "virtual-pollinators-flow.qs", package = "vbpflow")

df <-
  qread(pkg_data)

# xpectr::gxs_selection("distinct_input_select_years(df)")

## Testing 'distinct_input_select_years(df)'                                ####
## Initially generated by xpectr
xpectr::set_test_seed(42)
# Assigning output
output_19370 <- distinct_input_select_years(df)
# Testing class
expect_equal(
  class(output_19370),
  "character",
  fixed = TRUE
)
# Testing type
expect_type(
  output_19370,
  type = "character"
)
# Testing values
expect_equal(
  output_19370,
  c(
    "All years", "2001", "2002", "2003", "2004", "2005", "2006", "2007",
    "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015"
  ),
  fixed = TRUE
)
# Testing names
expect_equal(
  names(output_19370),
  NULL,
  fixed = TRUE
)
# Testing length
expect_equal(
  length(output_19370),
  16L
)
# Testing sum of element lengths
expect_equal(
  sum(xpectr::element_lengths(output_19370)),
  16L
)
## Finished testing 'distinct_input_select_years(df)'                       ####
virtual-pollination-trade/virtual-biotic-pollination-flow documentation built on May 3, 2021, 4:40 p.m.