tests/testthat/test-key-slope.R

test_that("key_slope does not handle character input", {
  expect_error(key_slope(heights, "height_cm ~ year"))
})

test_that("key_slope does not fail", {
  expect_s3_class(key_slope(heights, height_cm ~ year), "tbl_df")
})

test_that("key_slope fails when given non-formula", {
  expect_error(key_slope(heights, "height_cm year"))
  expect_error(key_slope(heights, height_cm + .))
  expect_error(key_slope(heights, height_cm))
})

test_that("add_key_slope does not handle character input", {
  expect_error(add_key_slope(heights, "height_cm ~ year"))
})

test_that("add_key_slope does not fail", {
  expect_s3_class(add_key_slope(heights, height_cm ~ year), "tbl_df")
})


test_that("add_key_slope fails when given non-formula", {
  expect_error(add_key_slope(heights, "height_cm year"))
  expect_error(add_key_slope(heights, height_cm + .))
  expect_error(add_key_slope(heights, height_cm))
})
njtierney/brolgar documentation built on Feb. 12, 2023, 12:14 a.m.