tests/testthat/test-r-plottime.R

context("test-r-plottime")

testthat::test_that("plotTime is correctly constructed", {
  df <- simData(25, 1)
  p <- plotTime(df, timespan = "DayWeekName")
  expect_true(ggplot2::is.ggplot(p))
  expect_equal(length(p$layers), 2)
  expect_equal(p$labels$y, "Number of workouts")
  expect_equal(p$labels$title, "Workouts per DayWeekName")
  geoms <- sapply(p$layers, function(x) class(x$geom)[1])
  expect_equal(geoms, c("GeomCol", "GeomText"))
  # expect_equal(p$layers[[2]]$mapping$label, "Count")
})


# plotTime(df, timespan = "Year")
# plotTime(df, timespan = "Month")
# plotTime(df, timespan = "Week")
# plotTime(df, timespan = "DayWeekName")
#
# plotTimespans(df)
MarijnJABoer/HeavySetR documentation built on May 22, 2019, 5:31 p.m.