use chrono::{Duration, Utc}; use domain::entities::{ScopeType, ShareScope, ShareableType}; use domain::value_objects::{DateTimeStamp, SystemId}; #[test] fn not_expired_when_no_expiry() { let scope = ShareScope::new(ScopeType::Link, ShareableType::Album, SystemId::new(), SystemId::new()); assert!(!scope.is_expired()); } #[test] fn expired_when_past() { let mut scope = ShareScope::new(ScopeType::Link, ShareableType::Album, SystemId::new(), SystemId::new()); scope.expires_at = Some(DateTimeStamp::from_datetime(Utc::now() - Duration::hours(1))); assert!(scope.is_expired()); }