| 1944 | |
| 1945 | #[test] |
| 1946 | fn test_hash_stability() { |
| 1947 | // Same change content should always produce same hash |
| 1948 | // Use a fixed timestamp to ensure deterministic hashing |
| 1949 | let fixed_ts = chrono::DateTime::parse_from_rfc3339("2024-01-15T10:30:00Z") |
| 1950 | .unwrap() |
| 1951 | .with_timezone(&chrono::Utc); |
| 1952 | |
| 1953 | let make_change = || { |
| 1954 | let header = ChangeHeader::builder() |
| 1955 | .message("Stable hash test") |
| 1956 | .timestamp(fixed_ts) |
| 1957 | .build(); |
| 1958 | Change::new(header, vec![], b"content".to_vec(), vec![]) |
| 1959 | }; |
| 1960 | |
| 1961 | let hash1 = make_change().hash().unwrap(); |
| 1962 | let hash2 = make_change().hash().unwrap(); |
| 1963 | |
| 1964 | assert_eq!(hash1, hash2); |
| 1965 | } |
| 1966 | |
| 1967 | #[test] |
| 1968 | fn test_v3_magic_bytes() { |