test_that("basic sanity checks for spec occur", {
expect_snapshot({
(expect_error(check_pivot_spec(1)))
(expect_error(check_pivot_spec(mtcars)))
})
})
test_that("`.name` column must be a character vector", {
df <- tibble(.name = 1:2, .value = c("a", "b"))
expect_snapshot((expect_error(check_pivot_spec(df))))
})
test_that("`.value` column must be a character vector", {
df <- tibble(.name = c("x", "y"), .value = 1:2)
expect_snapshot((expect_error(check_pivot_spec(df))))
})
test_that("`.name` column must be unique", {
df <- tibble(.name = c("x", "x"), .value = c("a", "b"))
expect_snapshot((expect_error(check_pivot_spec(df))))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.