| 1195 | |
| 1196 | #[test] |
| 1197 | fn test_hash_stability() { |
| 1198 | // Same change content should always produce same hash |
| 1199 | // Use a fixed timestamp to ensure deterministic hashing |
| 1200 | let fixed_ts = chrono::DateTime::parse_from_rfc3339("2024-01-15T10:30:00Z") |
| 1201 | .unwrap() |
| 1202 | .with_timezone(&chrono::Utc); |
| 1203 | |
| 1204 | let make_change = || { |
| 1205 | let header = ChangeHeader::builder() |
| 1206 | .message("Stable hash test") |
| 1207 | .timestamp(fixed_ts) |
| 1208 | .build(); |
| 1209 | Change::new(header, vec![], b"content".to_vec(), vec![]) |
| 1210 | }; |
| 1211 | |
| 1212 | let hash1 = make_change().hash().unwrap(); |
| 1213 | let hash2 = make_change().hash().unwrap(); |
| 1214 | |
| 1215 | assert_eq!(hash1, hash2); |
| 1216 | } |
| 1217 | |
| 1218 | #[test] |
| 1219 | fn test_v3_magic_bytes() { |