Skip to content

Commit

Permalink
Add a real test
Browse files Browse the repository at this point in the history
  • Loading branch information
chainsawriot committed Nov 9, 2023
1 parent 30c436a commit 02b416d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/testthat/test_resolve.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,20 @@ test_that(".generate_pubdate", {
x <- data.frame(`Date/Publication` = NA, date = "b", crandb_file_date = "c")
colnames(x)[1] <- "Date/Publication"
expect_equal(.generate_pubdate(x), "b")
## real test
data <- structure(list(date = c("2012-10-30T20:05:45+00:00", "2014-11-24T11:48:55+00:00",
"2001-05-15T09:00:31+00:00", "2016-10-20T20:59:35+00:00", "2016-10-28T23:11:52+00:00",
"2023-08-22T08:10:02+00:00"), crandb_file_date = c("2023-08-24 10:00:31",
"2023-08-24 10:00:31", "2023-08-24 10:00:31", "2023-08-24 10:00:32",
"2023-08-24 10:00:32", "2023-08-24 10:00:32"), `Date/Publication` = c("2012-10-30 21:05:45",
"2014-11-24 12:48:55", NA, "2016-10-20 21:59:35", "2016-10-29 00:11:52",
"2023-08-22 09:10:02 UTC")), class = c("tbl", "data.frame"), row.names = c("acepack.1.3-3.2",
"acepack.1.3-3.3", "acepack.1.3", "acepack.1.4.0", "acepack.1.4.1",
"acepack.1.4.2"))
expect_equal(.generate_pubdate(data), c("2012-10-30T20:05:45+00:00", "2014-11-24T11:48:55+00:00", "2001-05-15T09:00:31+00:00", "2016-10-20T20:59:35+00:00", "2016-10-28T23:11:52+00:00", "2023-08-22T08:10:02+00:00"))
})


## The following are real tests. Even with memoisation, please keep at minimum

test_that("normal", {
Expand Down

0 comments on commit 02b416d

Please sign in to comment.