Skip to content

Commit

Permalink
tests pass locally
Browse files Browse the repository at this point in the history
  • Loading branch information
dcooley committed Jan 17, 2024
1 parent ed74644 commit 1a6de7b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions tests/testthat/test-to_json_dates.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test_that("Dates are handled", {
expect_equal( as.character( to_json( x, numeric_dates = FALSE ) ), '["2017-12-31T13:00:00"]' )

x <- as.POSIXlt("2018-01-01", tz = "GMT")
expect_equal( as.character( to_json( x , numeric_dates = FALSE) ), '{"sec":[0.0],"min":[0],"hour":[0],"mday":[1],"mon":[0],"year":[118],"wday":[1],"yday":[0],"isdst":[0]}')
expect_equal( as.character( to_json( x , numeric_dates = FALSE) ), '{"sec":[0.0],"min":[0],"hour":[0],"mday":[1],"mon":[0],"year":[118],"wday":[1],"yday":[0],"isdst":[0],"zone":["GMT"],"gmtoff":[0]}')

})

Expand Down Expand Up @@ -106,5 +106,6 @@ test_that("posixlt not converted to numeric",{

p <- as.POSIXlt("2019-01-01 00:00:00", tz = "GMT") ## so travis works
res <- to_json(p, numeric_dates = F)
expect_equal( as.character( res ), '{"sec":[0.0],"min":[0],"hour":[0],"mday":[1],"mon":[0],"year":[119],"wday":[2],"yday":[0],"isdst":[0]}')
})
expect_equal( as.character( res ), '{"sec":[0.0],"min":[0],"hour":[0],"mday":[1],"mon":[0],"year":[119],"wday":[2],"yday":[0],"isdst":[0],"zone":["GMT"],"gmtoff":[0]}')
})

2 changes: 1 addition & 1 deletion tests/testthat/test-to_json_unbox.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ test_that("Posixlt unboxed", {

x <- as.POSIXlt("2018-01-01 01:00:00", tz = "GMT")
js <- to_json(x, unbox = T)
expect_equal( as.character( js ), "{\"sec\":0.0,\"min\":0,\"hour\":1,\"mday\":1,\"mon\":0,\"year\":118,\"wday\":1,\"yday\":0,\"isdst\":0}" )
expect_equal( as.character( js ), "{\"sec\":0.0,\"min\":0,\"hour\":1,\"mday\":1,\"mon\":0,\"year\":118,\"wday\":1,\"yday\":0,\"isdst\":0,\"zone\":\"GMT\",\"gmtoff\":0}" )
expect_true( validate_json( js ) )
})

Expand Down

0 comments on commit 1a6de7b

Please sign in to comment.