Skip to content

Commit bac8917

Browse files
committed
align audit replay tests with emitted events
1 parent a9f2ef1 commit bac8917

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

contracts/ledgerlens-score/src/test_audit_replay.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ mod test_audit_replay {
4040
let contract_events: StdVec<_> =
4141
all_events.iter().filter(|(addr, _, _)| addr == &contract_id).collect();
4242

43-
// Assert: We should have initialization and watchlist events
44-
assert!(contract_events.len() >= 2, "Should have at least initialize and watchlist events");
43+
// Initialization does not emit an audit event; the watchlist mutation does.
44+
assert_eq!(contract_events.len(), 1, "Should have one watchlist event");
4545

4646
// For each event, verify it can be used for audit trail
4747
for (addr, topics, data) in contract_events.iter() {
@@ -100,11 +100,8 @@ mod test_audit_replay {
100100
let contract_events: StdVec<_> =
101101
all_events.iter().filter(|(addr, _, _)| addr == &contract_id).collect();
102102

103-
// Should have initialization and admin_transfer_initiated events
104-
assert!(
105-
contract_events.len() >= 2,
106-
"Should have at least initialize and admin_transfer_initiated events"
107-
);
103+
// Initialization does not emit an audit event; the transfer mutation does.
104+
assert_eq!(contract_events.len(), 1, "Should have one admin transfer event");
108105

109106
// All events should have consistent structure
110107
for (addr, topics, _data) in contract_events.iter() {
@@ -355,10 +352,7 @@ mod test_audit_replay {
355352
all_events.iter().filter(|(addr, _, _)| addr == &contract_id).collect();
356353

357354
// Verify we have events from multiple operations
358-
assert!(
359-
contract_events.len() >= 3,
360-
"Should have multiple events from different operations"
361-
);
355+
assert_eq!(contract_events.len(), 2, "Should have one event per watchlist operation");
362356

363357
// Each event should be independently verifiable
364358
for (addr, topics, _data) in contract_events.iter() {

0 commit comments

Comments
 (0)