test: pin accepted_state's contract — main tier, blocked, never accepted

This commit is contained in:
randogoth 2026-09-29 11:58:00 +03:00
parent 1c4011325f
commit 45987fe03d

View file

@ -901,6 +901,18 @@ mod tests {
assert_eq!(store.history("alice@example.org").unwrap(), [([9u8; 32], 42)]);
}
#[test]
fn accepted_state_reads_the_row_not_a_wish() {
let store = temp_store("accepted-state");
let identity = [9u8; KEY_LEN];
assert_eq!(store.accepted_state("a@example.org").unwrap(), None);
store.accept("a@example.org", &identity).unwrap();
assert_eq!(store.accepted_state("a@example.org").unwrap(), Some(true));
// block() is an UPDATE, not a DELETE: the row survives at active = 0.
store.block("a@example.org").unwrap();
assert_eq!(store.accepted_state("a@example.org").unwrap(), Some(false));
}
#[test]
fn unpin_returns_to_trust_on_first_use() {
let store = temp_store("unpin");