test(core): backup round-trips git archive + size check
This commit is contained in:
@@ -104,3 +104,30 @@ fn round_trip_with_reference_image() {
|
||||
assert_eq!(unpacked.reference_jpg.as_deref(), Some(jpg_bytes.as_slice()));
|
||||
assert!(unpacked.git_archive.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn round_trip_with_git_archive() {
|
||||
let tar_bytes: Vec<u8> = b"FAKE TAR BYTES; core treats opaquely".repeat(50);
|
||||
let mut input = empty_input();
|
||||
input.git_archive = Some(&tar_bytes);
|
||||
|
||||
let out = pack_backup(input, "p").unwrap();
|
||||
let unpacked = unpack_backup(&out, "p").unwrap();
|
||||
|
||||
assert_eq!(unpacked.git_archive.as_deref(), Some(tar_bytes.as_slice()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_history_produces_strict_subset() {
|
||||
let mut a = empty_input();
|
||||
a.git_archive = Some(b"some-tar-bytes");
|
||||
let with = pack_backup(a, "p").unwrap();
|
||||
|
||||
let without = pack_backup(empty_input(), "p").unwrap();
|
||||
|
||||
// The "without" file is strictly smaller (one fewer base64-encoded blob in JSON).
|
||||
assert!(without.len() < with.len(),
|
||||
"no-history backup should be smaller: with={}, without={}",
|
||||
with.len(), without.len()
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user