library(timetrackr)
context("Reading in report data")
# Example data file
example_text_file <- "example_text_data.csv"
#example_text_file <- "tests/testthat/example_text_data.csv"
# Reading in data
example_time_data <- time_1read(example_text_file)
# Expected output (18th line)
expected_output_18 <- tibble::tibble(
start_dttm = lubridate::ymd_hm("2017-06-17, 22:10", tz = "Australia/Adelaide"),
activity = "01. Sleep",
notes = "",
end_dttm = lubridate::ymd_hm("2017-06-18, 06:00", tz = "Australia/Adelaide"),
ind_row_order = TRUE
)
# Expected output (13th line)
expected_output_13 <- tibble::tibble(
start_dttm = lubridate::ymd_hm("2017-06-15, 22:00", tz = "Australia/Adelaide"),
activity = "05. 12WY",
notes = "Comm1 This is a tag 1",
end_dttm = lubridate::ymd_hm("2017-06-16, 06:00", tz = "Australia/Adelaide"),
ind_row_order = TRUE
)
# Expected output (11th line)
expected_output_11 <- tibble::tibble(
start_dttm = lubridate::ymd_hm("2017-06-14, 21:01", tz = "Australia/Adelaide"),
activity = "07. Learn",
notes = "This is a tag 1",
end_dttm = lubridate::ymd_hm("2017-06-15, 05:30", tz = "Australia/Adelaide"),
ind_row_order = TRUE
)
# Expectation
test_that("Time data can be read in correctly",{
expect_equal(dplyr::slice(example_time_data, 18), expected_output_18)
expect_equal(dplyr::slice(example_time_data, 13), expected_output_13)
expect_equal(dplyr::slice(example_time_data, 11), expected_output_11)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.