Skip to content

Commit

Permalink
Fix juniper tests for latest chrono version
Browse files Browse the repository at this point in the history
  • Loading branch information
tyranron committed Sep 9, 2023
1 parent df9da4c commit efaebf1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]

members = [
"benches",
"examples/basic_subscriptions",
Expand Down
36 changes: 28 additions & 8 deletions juniper/src/integrations/chrono.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ mod date_time_test {
for (raw, expected) in [
(
"2014-11-28T21:00:09+09:00",
DateTime::<FixedOffset>::from_utc(
DateTime::<FixedOffset>::from_naive_utc_and_offset(
NaiveDateTime::new(
NaiveDate::from_ymd_opt(2014, 11, 28).unwrap(),
NaiveTime::from_hms_opt(12, 0, 9).unwrap(),
Expand All @@ -603,7 +603,17 @@ mod date_time_test {
),
(
"2014-11-28T21:00:09Z",
DateTime::<FixedOffset>::from_utc(
DateTime::<FixedOffset>::from_naive_utc_and_offset(
NaiveDateTime::new(
NaiveDate::from_ymd_opt(2014, 11, 28).unwrap(),
NaiveTime::from_hms_opt(21, 0, 9).unwrap(),
),
FixedOffset::east_opt(0).unwrap(),
),
),
(
"2014-11-28 21:00:09z",
DateTime::<FixedOffset>::from_naive_utc_and_offset(
NaiveDateTime::new(
NaiveDate::from_ymd_opt(2014, 11, 28).unwrap(),
NaiveTime::from_hms_opt(21, 0, 9).unwrap(),
Expand All @@ -613,7 +623,7 @@ mod date_time_test {
),
(
"2014-11-28T21:00:09+00:00",
DateTime::<FixedOffset>::from_utc(
DateTime::<FixedOffset>::from_naive_utc_and_offset(
NaiveDateTime::new(
NaiveDate::from_ymd_opt(2014, 11, 28).unwrap(),
NaiveTime::from_hms_opt(21, 0, 9).unwrap(),
Expand All @@ -623,7 +633,17 @@ mod date_time_test {
),
(
"2014-11-28T21:00:09.05+09:00",
DateTime::<FixedOffset>::from_utc(
DateTime::<FixedOffset>::from_naive_utc_and_offset(
NaiveDateTime::new(
NaiveDate::from_ymd_opt(2014, 11, 28).unwrap(),
NaiveTime::from_hms_milli_opt(12, 0, 9, 50).unwrap(),
),
FixedOffset::east_opt(0).unwrap(),
),
),
(
"2014-11-28 21:00:09.05+09:00",
DateTime::<FixedOffset>::from_naive_utc_and_offset(
NaiveDateTime::new(
NaiveDate::from_ymd_opt(2014, 11, 28).unwrap(),
NaiveTime::from_hms_milli_opt(12, 0, 9, 50).unwrap(),
Expand Down Expand Up @@ -652,7 +672,7 @@ mod date_time_test {
graphql_input_value!("56:34:22"),
graphql_input_value!("56:34:22.000"),
graphql_input_value!("1996-12-1914:23:43"),
graphql_input_value!("1996-12-19 14:23:43Z"),
graphql_input_value!("1996-12-19Q14:23:43Z"),
graphql_input_value!("1996-12-19T14:23:43"),
graphql_input_value!("1996-12-19T14:23:43ZZ"),
graphql_input_value!("1996-12-19T14:23:43.543"),
Expand Down Expand Up @@ -682,7 +702,7 @@ mod date_time_test {
fn formats_correctly() {
for (val, expected) in [
(
DateTime::<FixedOffset>::from_utc(
DateTime::<FixedOffset>::from_naive_utc_and_offset(
NaiveDateTime::new(
NaiveDate::from_ymd_opt(1996, 12, 19).unwrap(),
NaiveTime::from_hms_opt(0, 0, 0).unwrap(),
Expand All @@ -692,7 +712,7 @@ mod date_time_test {
graphql_input_value!("1996-12-19T00:00:00Z"),
),
(
DateTime::<FixedOffset>::from_utc(
DateTime::<FixedOffset>::from_naive_utc_and_offset(
NaiveDateTime::new(
NaiveDate::from_ymd_opt(1564, 1, 30).unwrap(),
NaiveTime::from_hms_milli_opt(5, 0, 0, 123).unwrap(),
Expand Down Expand Up @@ -780,7 +800,7 @@ mod integration_test {
}

fn date_time() -> DateTime<chrono::Utc> {
DateTime::from_utc(
DateTime::from_naive_utc_and_offset(
LocalDateTime::new(
Date::from_ymd_opt(1996, 12, 20).unwrap(),
LocalTime::from_hms_opt(0, 39, 57).unwrap(),
Expand Down

0 comments on commit efaebf1

Please sign in to comment.