Skip to content

Commit

Permalink
Add ZonedDateTime and TimeZone to integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
sgoll committed Aug 16, 2024
1 parent ce43466 commit 4301b9c
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions juniper/src/integrations/jiff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1120,15 +1120,15 @@ 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,
schema::model::RootNode,
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() {
Expand All @@ -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)
Expand All @@ -1171,6 +1181,8 @@ mod integration_test {
localTime
localDateTime
dateTime,
zonedDateTime,
timeZone,
duration,
}"#;

Expand All @@ -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![],
Expand Down

0 comments on commit 4301b9c

Please sign in to comment.