Update tests to use DateTime's for timestamps

This commit is contained in:
Quat3rnion 2024-06-02 18:12:52 -04:00
parent 7b7294433b
commit ab4435a79f
2 changed files with 9 additions and 5 deletions

View File

@ -2,6 +2,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
use std::str::FromStr;
use chrono::DateTime;
use chorus::types::{LoginSchema, RegisterSchema};
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::*;
@ -16,7 +18,7 @@ async fn test_registration() {
let mut bundle = common::setup().await;
let reg = RegisterSchema {
username: "Hiiii".into(),
date_of_birth: Some("2000-01-01".to_string()),
date_of_birth: Some(DateTime::from_str("2000-01-01").unwrap()),
consent: true,
..Default::default()
};
@ -32,7 +34,7 @@ async fn test_login() {
username: "Hiiii".into(),
email: Some("testuser1@integrationtesting.xyz".into()),
password: Some("Correct-Horse-Battery-Staple1".into()),
date_of_birth: Some("2000-01-01".to_string()),
date_of_birth: Some(DateTime::from_str("2000-01-01").unwrap()),
consent: true,
..Default::default()
};
@ -54,7 +56,7 @@ async fn test_wrong_login() {
username: "Hiiii".into(),
email: Some("testuser2@integrationtesting.xyz".into()),
password: Some("Correct-Horse-Battery-Staple1".into()),
date_of_birth: Some("2000-01-01".to_string()),
date_of_birth: Some(DateTime::from_str("2000-01-01").unwrap()),
consent: true,
..Default::default()
};

View File

@ -2,6 +2,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
use std::str::FromStr;
use chrono::DateTime;
use chorus::gateway::Gateway;
use chorus::types::IntoShared;
use chorus::{
@ -30,7 +32,7 @@ impl TestBundle {
let register_schema = RegisterSchema {
username: username.to_string(),
consent: true,
date_of_birth: Some("2000-01-01".to_string()),
date_of_birth: Some(DateTime::from_str("2000-01-01").unwrap()),
..Default::default()
};
self.instance
@ -60,7 +62,7 @@ pub(crate) async fn setup() -> TestBundle {
let reg = RegisterSchema {
username: "integrationtestuser".into(),
consent: true,
date_of_birth: Some("2000-01-01".to_string()),
date_of_birth: Some(DateTime::from_str("2000-01-01").unwrap()),
..Default::default()
};
let guild_create_schema = GuildCreateSchema {