Corrected trigger tests.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s

This commit is contained in:
2026-03-08 17:05:47 -04:00
parent c7054e4306
commit b96bbbe21d
2 changed files with 67 additions and 50 deletions

View File

@@ -93,21 +93,28 @@ fn are_session_ids_unique_on_update() {
}
#[test]
fn does_expire_update_on_query() {
let mut mtt = MoreThanText::new();
fn does_expire_updates_on_query() {
let id_name = Name::english("id");
let expire_name = Name::english("expire");
let mut test_env = TestMoreThanText::new();
let mut mtt = test_env.get_morethantext();
let id = mtt.validate_session(None);
let start_time = Utc::now() + Duration::from_secs(3600);
let path = Path::new(
Include::All,
Include::Just(doc_name().into()),
Include::Just(Action::OnUpdate),
);
test_env.register_channel(vec![path]);
let start_time: Field = (Utc::now() + Duration::from_secs(3600)).into();
mtt.validate_session(Some(id.to_string()));
let end_time = Utc::now() + Duration::from_secs(3601);
let rec = get_session(&mut mtt, &id).unwrap();
let holder = rec.get(Name::english("expire")).unwrap();
match holder {
Field::DateTime(data) => {
assert!(data > start_time, "expire should be after {:?}", start_time);
assert!(data < end_time, "expire should be before {:?}", end_time);
}
_ => unreachable!("got {:?} should have been date time", holder),
}
let end_time: Field = (Utc::now() + Duration::from_secs(3601)).into();
let result = test_env.get_trigger_records(Action::OnUpdate);
assert_eq!(result.len(), 1);
let rec = result.iter().last().unwrap();
assert_eq!(rec.get(&id_name).unwrap(), id.into());
let data = rec.get(&expire_name).unwrap();
assert!(data > start_time, "expire should be after {:?}", start_time);
assert!(data < end_time, "expire should be before {:?}", end_time);
}
#[test]