From e4949c4c06a80d0c036ec17445f81543fa61863f Mon Sep 17 00:00:00 2001 From: adlee-was-taken Date: Mon, 27 Apr 2026 22:37:38 -0400 Subject: [PATCH] test(core): backup round-trips reference image bytes --- crates/relicario-core/tests/backup.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/relicario-core/tests/backup.rs b/crates/relicario-core/tests/backup.rs index d424e89..8274dd9 100644 --- a/crates/relicario-core/tests/backup.rs +++ b/crates/relicario-core/tests/backup.rs @@ -91,3 +91,16 @@ fn populated_vault_round_trip() { assert_eq!(by_aid.get(&("1111111111111111", "aaaa1111")).unwrap(), &&attach_x_ct); assert_eq!(by_aid.get(&("2222222222222222", "bbbb2222")).unwrap(), &&attach_y_ct); } + +#[test] +fn round_trip_with_reference_image() { + let jpg_bytes: Vec = (0u8..=255).cycle().take(1024 * 64).collect(); // 64 KiB + let mut input = empty_input(); + input.reference_jpg = Some(&jpg_bytes); + + let out = pack_backup(input, "p").unwrap(); + let unpacked = unpack_backup(&out, "p").unwrap(); + + assert_eq!(unpacked.reference_jpg.as_deref(), Some(jpg_bytes.as_slice())); + assert!(unpacked.git_archive.is_none()); +}