From 4301b9c9b4df0f02375ca54633e865ee09dd15bc Mon Sep 17 00:00:00 2001 From: Sebastian Goll Date: Fri, 16 Aug 2024 03:23:10 +0200 Subject: [PATCH] Add ZonedDateTime and TimeZone to integration test --- juniper/src/integrations/jiff.rs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/juniper/src/integrations/jiff.rs b/juniper/src/integrations/jiff.rs index ffafb63bb..c6f513daa 100644 --- a/juniper/src/integrations/jiff.rs +++ b/juniper/src/integrations/jiff.rs @@ -1120,7 +1120,7 @@ mod time_zone_test { #[cfg(test)] mod integration_test { - use jiff::{civil, tz::TimeZone, ToSpan as _}; + use jiff::{civil, tz, ToSpan as _}; use crate::{ execute, graphql_object, graphql_value, graphql_vars, @@ -1128,7 +1128,7 @@ mod integration_test { types::scalars::{EmptyMutation, EmptySubscription}, }; - use super::{DateTime, Duration, LocalDate, LocalDateTime, LocalTime}; + use super::{DateTime, Duration, LocalDate, LocalDateTime, LocalTime, TimeZone, ZonedDateTime}; #[tokio::test] async fn serializes() { @@ -1150,11 +1150,21 @@ mod integration_test { fn date_time() -> DateTime { civil::DateTime::constant(2014, 11, 28, 12, 0, 9, 50_000_000) - .to_zoned(TimeZone::UTC) + .to_zoned(tz::TimeZone::UTC) .unwrap() .timestamp() } + fn zoned_date_time() -> ZonedDateTime { + civil::DateTime::constant(2014, 11, 28, 12, 0, 9, 50_000_000) + .to_zoned(tz::TimeZone::get("America/New_York").unwrap()) + .unwrap() + } + + fn time_zone() -> TimeZone { + tz::TimeZone::get("Asia/Tokyo").unwrap() + } + fn duration() -> Duration { 1.year() .months(1) @@ -1171,6 +1181,8 @@ mod integration_test { localTime localDateTime dateTime, + zonedDateTime, + timeZone, duration, }"#; @@ -1188,6 +1200,8 @@ mod integration_test { "localTime": "16:07:08", "localDateTime": "2016-07-08T09:10:11", "dateTime": "2014-11-28T12:00:09.05Z", + "zonedDateTime": "2014-11-28T12:00:09.05-05:00[America/New_York]", + "timeZone": "Asia/Tokyo", "duration": "P1y1m1dT1h1m1.1s", }), vec![],