😎 Give your xaringan slides some style
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 satır
783B

  1. # test_that()
  2. describe("prepare_colors()", {
  3. it("returns NULL if NULL or missing", {
  4. expect_null(prepare_colors())
  5. expect_null(prepare_colors(NULL))
  6. expect_null(prepare_colors(list()))
  7. })
  8. it("requires a named vector or list", {
  9. expect_error(prepare_colors("#00FF00"))
  10. })
  11. it("requires valid CSS names", {
  12. expect_error(prepare_colors(c("light blue" = "#88f")))
  13. expect_error(preapre_colors(c("light/blue" = "#88f")))
  14. })
  15. it("returns list with color_name and value for each color", {
  16. colors <- c('test' = "#4ed4ed")
  17. prepared <- prepare_colors(colors)
  18. expect_equal(names(prepared[[1]]), c("color_name", "value"))
  19. expect_equal(prepared[[1]]$color_name, names(colors)[[1]])
  20. expect_equal(prepared[[1]]$value, colors[[1]])
  21. })
  22. })