diff --git a/crates/matrix-sdk-crypto/src/types/events/utd_cause.rs b/crates/matrix-sdk-crypto/src/types/events/utd_cause.rs index b316bcb55ec..c7d2a0810fc 100644 --- a/crates/matrix-sdk-crypto/src/types/events/utd_cause.rs +++ b/crates/matrix-sdk-crypto/src/types/events/utd_cause.rs @@ -152,6 +152,10 @@ mod tests { use crate::types::events::{utd_cause::CryptoContextInfo, UtdCause}; + const EVENT_TIME: usize = 5555; + const BEFORE_EVENT_TIME: usize = 1111; + const AFTER_EVENT_TIME: usize = 9999; + #[test] fn test_if_there_is_no_membership_info_we_guess_unknown() { // If our JSON contains no membership info, then we guess the UTD is unknown. @@ -380,7 +384,7 @@ mod tests { "session_id": "A0", }, "sender": "@bob:localhost", - "origin_server_ts": 5555, + "origin_server_ts": EVENT_TIME, "unsigned": { "membership": "join" } })) } @@ -391,28 +395,28 @@ mod tests { fn device_old_no_backup() -> CryptoContextInfo { CryptoContextInfo { - device_creation_ts: MilliSecondsSinceUnixEpoch((1111).try_into().unwrap()), + device_creation_ts: MilliSecondsSinceUnixEpoch((BEFORE_EVENT_TIME).try_into().unwrap()), is_backup_configured: false, } } fn device_old_with_backup() -> CryptoContextInfo { CryptoContextInfo { - device_creation_ts: MilliSecondsSinceUnixEpoch((1111).try_into().unwrap()), + device_creation_ts: MilliSecondsSinceUnixEpoch((BEFORE_EVENT_TIME).try_into().unwrap()), is_backup_configured: true, } } fn device_new_no_backup() -> CryptoContextInfo { CryptoContextInfo { - device_creation_ts: MilliSecondsSinceUnixEpoch((9999).try_into().unwrap()), + device_creation_ts: MilliSecondsSinceUnixEpoch((AFTER_EVENT_TIME).try_into().unwrap()), is_backup_configured: false, } } fn device_new_with_backup() -> CryptoContextInfo { CryptoContextInfo { - device_creation_ts: MilliSecondsSinceUnixEpoch((9999).try_into().unwrap()), + device_creation_ts: MilliSecondsSinceUnixEpoch((AFTER_EVENT_TIME).try_into().unwrap()), is_backup_configured: true, } }