Asset descriptions can change: books.label_asset description, journaled as asset.described (with the old one), replayed, projected, shown in the journal
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GWVo7x3UHw5kwCUaWxiejX
This commit is contained in:
1 parent
2e14c702c0
commit
49c49aef33
6 files changed
+127
-3
No files matched your search
@@ -499,3 +499,28 @@ fn verify_compares_amounts_by_value() {
|
||||
Store::open(&dir).unwrap().verify().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
/// A description change is journaled with the old one, replays on reopen
|
||||
/// and from the journal alone, and verifies; a blank one is refused and
|
||||
/// journals nothing.
|
||||
#[test]
|
||||
fn a_description_change_replays_and_verifies() {
|
||||
let (dir, mut s, _, x, _) = fixture("described");
|
||||
let before = journal(&dir).len();
|
||||
assert!(s.set_asset_description(x, " ").is_err());
|
||||
assert_eq!(journal(&dir).len(), before, "a refusal journals nothing");
|
||||
s.set_asset_description(x, "Laptop, contributed jointly")
|
||||
.unwrap();
|
||||
let (kind, p) = journal(&dir).pop().unwrap();
|
||||
assert_eq!(kind, "asset.described");
|
||||
assert_eq!(p["description"], "Laptop, contributed jointly");
|
||||
s.verify().unwrap();
|
||||
drop(s);
|
||||
std::fs::remove_file(dir.join(DB_FILE)).unwrap();
|
||||
let s = Store::open(&dir).unwrap();
|
||||
assert_eq!(
|
||||
s.ledger().get_asset(x).unwrap().description,
|
||||
"Laptop, contributed jointly"
|
||||
);
|
||||
s.verify().unwrap();
|
||||
}
|
||||
Reference in new issue
Block a user