tests/testthat/test-jdcbill.R

context("jdcbill")

# test non-numeric hours
# bug when last  expression is /noproj, since then adds proj ""  with 0 hours.
test_that("workflow", {
  expect_true(lubridate::is.Date(dw$date))

  # subset
  dw.ss <- subset_by_date(dw = dw, mo = "Sep", yr = 2019)
  expect_gt(nrow(dw.ss), 0)

  # parsing
  expect_warning(dw.usage <- parse_daily_work(dw.ss))
  expect_true(all.equal(dw.usage, prior.dw.usage))

  # summarizing
  dw.summary <- summarize_usage(usage=dw.usage, proj = proj)
  rownames(dw.summary) <- 1:nrow(dw.summary)
  expect_true(all.equal(dw.summary, prior.summary))
})

# test that projects don't contain spaces at ends or "/:;"
jdreyf/jdcbill documentation built on Nov. 4, 2019, 2:35 p.m.