tests/testthat/test_measure_change_over_time_long.R

p <- measure_change_over_time_long(ggplot2::economics_long, date, variable, value, pop, unemploy)
test_that("Plot layers match expectations",{
  expect_is(p$layers[[1]], "ggproto")
})

test_that("Plot returns ggplot object",{
  expect_is(p, "ggplot")
})

test_that("Plot uses correct data",{
  expect_equal(TRUE, all(c("date", "variable", "value") %in% names(p$data)))
})
test_that("x axis is labeled 'date'",{
  expect_match(p$labels$x, "date")
})

test_that("y axis is labeled 'value'",{
  expect_match(p$labels$y, "value")
})

Try the ezEDA package in your browser

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

ezEDA documentation built on June 29, 2021, 9:05 a.m.