Skip to content

Commit c5ee8b8

Browse files
committed
add test
1 parent 6b680a4 commit c5ee8b8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/testthat/test-scale_date.R

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11

2+
test_that("date(time) scales coerce data types", {
3+
4+
date <- as.Date("2024-11-11")
5+
datetime <- as.POSIXct(date)
6+
7+
sc <- scale_x_datetime()
8+
df <- sc$transform_df(data.frame(x = date))
9+
expect_equal(df$x, as.numeric(datetime))
10+
11+
sc <- scale_x_date()
12+
df <- sc$transform_df(data.frame(x = datetime))
13+
expect_equal(df$x, as.numeric(date))
14+
15+
})
16+
217
# Visual tests ------------------------------------------------------------
318

419
test_that("date scale draws correctly", {

0 commit comments

Comments
 (0)