mirror of
https://github.com/chatmail/core.git
synced 2026-05-16 21:36:30 +03:00
simplify test code
This commit is contained in:
@@ -2868,15 +2868,13 @@ mod tests {
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
// Timed in the future
|
// Timed in the future
|
||||||
let current_timestamp = SystemTime::now().duration_since(UNIX_EPOCH).unwrap() + Duration::from_secs(3600);
|
set_muted(&t.ctx, chat_id, MuteDuration::MutedUntilTimestamp(time() + 3600)).unwrap();
|
||||||
set_muted(&t.ctx, chat_id, MuteDuration::MutedUntilTimestamp(current_timestamp.as_secs() as i64)).unwrap();
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Chat::load_from_db(&t.ctx, chat_id).unwrap().is_muted(),
|
Chat::load_from_db(&t.ctx, chat_id).unwrap().is_muted(),
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
// Time in the past
|
// Time in the past
|
||||||
let past_timestamp = SystemTime::now().duration_since(UNIX_EPOCH).unwrap() - Duration::from_secs(3600);
|
set_muted(&t.ctx, chat_id, MuteDuration::MutedUntilTimestamp(time() - 3600)).unwrap();
|
||||||
set_muted(&t.ctx, chat_id, MuteDuration::MutedUntilTimestamp(past_timestamp.as_secs() as i64)).unwrap();
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Chat::load_from_db(&t.ctx, chat_id).unwrap().is_muted(),
|
Chat::load_from_db(&t.ctx, chat_id).unwrap().is_muted(),
|
||||||
false
|
false
|
||||||
|
|||||||
Reference in New Issue
Block a user