diff --git a/tests/testthat/test-to_json_dates.R b/tests/testthat/test-to_json_dates.R index 541d742..7298b28 100644 --- a/tests/testthat/test-to_json_dates.R +++ b/tests/testthat/test-to_json_dates.R @@ -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]}') }) @@ -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]}') -}) \ No newline at end of file + 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]}') +}) + diff --git a/tests/testthat/test-to_json_unbox.R b/tests/testthat/test-to_json_unbox.R index 8d11985..77c8e9a 100644 --- a/tests/testthat/test-to_json_unbox.R +++ b/tests/testthat/test-to_json_unbox.R @@ -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 ) ) })