tests/testthat/test_create_pareto.R

context("create_pareto")

data(words)

table <- create_table(words$letter_count)

plot <- create_pareto(table)

test_that("plot has the proper structure", {

      expect_that(plot, is_a("gg"))
      expect_that(plot$labels$title, equals("Pareto Chart"))
      expect_that(plot$labels$subtitle, equals(""))
      expect_that(plot$labels$caption, equals(""))
      expect_that(plot$labels$x, equals("Groups"))
      expect_that(plot$labels$y, equals("Frequency"))

})

test_that("plot uses correct data", {

   expect_that(table, equals(plot$data))

})

test_that("function returns an error", {

      expect_that(create_pareto(), throws_error())

})

Try the fdistr package in your browser

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

fdistr documentation built on Jan. 11, 2020, 9:13 a.m.