test(core): backup round-trips reference image bytes
This commit is contained in:
@@ -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(&("1111111111111111", "aaaa1111")).unwrap(), &&attach_x_ct);
|
||||||
assert_eq!(by_aid.get(&("2222222222222222", "bbbb2222")).unwrap(), &&attach_y_ct);
|
assert_eq!(by_aid.get(&("2222222222222222", "bbbb2222")).unwrap(), &&attach_y_ct);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn round_trip_with_reference_image() {
|
||||||
|
let jpg_bytes: Vec<u8> = (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());
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user