use super::timestamp_fixture::root;
#[test]
fn a_timestamptz_column_is_seeded_with_an_offset_aware_value() {
let root = root("timestamp with time zone", false);
assert!(
root.contains("created_at: Utc::now(),"),
"expected an offset-aware seed:\n{root}"
);
assert!(!root.contains("Utc::now().naive_utc()"), "got:\n{root}");
}
#[test]
fn a_naive_timestamp_column_is_seeded_with_a_naive_value() {
let root = root("timestamp without time zone", false);
assert!(
root.contains("created_at: Utc::now().naive_utc(),"),
"expected a naive seed:\n{root}"
);
}
#[test]
fn a_nullable_timestamptz_is_wrapped_in_some() {
let root = root("timestamp with time zone", true);
assert!(
root.contains("created_at: Some(Utc::now()),"),
"expected a wrapped offset-aware seed:\n{root}"
);
}
#[test]
fn the_import_matches_the_seed_the_file_uses() {
for sql_type in ["timestamp with time zone", "timestamp without time zone"] {
let root = root(sql_type, false);
assert!(
root.contains("use chrono::Utc;"),
"{sql_type} lost its import:\n{root}"
);
}
}