tests/testthat/test-hours.R

context("hours")

test_that("hours", {
  hours <- pts_calc_hours(poistimesheets::timesheet)
  expect_is(hours, "tbl_df")
  expect_identical(colnames(hours), c("Member", "HoursPerDay", "Hours",
                                      "ExtraHours", "VacationDays",
                                      "UnpaidLeave", 
                                      "HealthDays",  "PersonalPaid", "Billable"))
  expect_identical(hours$Member, c(
    "Evan Amies-Galonski", "Joseph Thorley", "Seb Dalgarno"))
  expect_identical(hours$HoursPerDay, rep(7.5, 3))
  expect_identical(hours$Hours, c(516.98, 564.85,  517.72))
  expect_equal(hours$ExtraHours, c(6.98, 54.85, 7.72))
  expect_identical(hours$VacationDays, c(2.7, 0, 5.5))
  expect_equal(hours$HealthDays, c(1, 0, 2.3333333))
  expect_equal(hours$PersonalPaid, c(0.00000000, 0.00501018, 0.14689413),
               tolerance = 1e-07)
  expect_equal(hours$Billable, c(0.8599227, 0.6572542, 0.8974844),
               tolerance = 1e-07)
})
poissonconsulting/poistimesheets documentation built on Jan. 24, 2020, 4:54 a.m.