Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions contracts/compliance/tests/compliance_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use compliance::{ComplianceContract, ComplianceContractClient, ContractError};
use soroban_sdk::{testutils::Address as _, Address, Env};
use soroban_sdk::{testutils::{Address as _, Events}, Address, Env, Symbol};

fn setup() -> (Env, Address, Address, ComplianceContractClient<'static>) {
let env = Env::default();
Expand Down Expand Up @@ -246,35 +246,30 @@ fn reinitialize_is_rejected() {
// Verification: address_allowed event schema
// - topics[0]: symbol "address_allowed"
// - data: single Address value for the allowed address
// The snapshot harness captures the full event payload (topics and data) for regression.
#[test]
fn emits_address_allowed_event() {
let (env, admin, subject, client) = setup();
client.allow_address(&admin, &subject);
assert!(client.is_allowed(&subject));
// Events are captured by the snapshot test harness; no additional assertions needed here.
let _ = env;
assert_eq!(last_event_symbol(&env), "address_allowed");
}

// Verification: address_blocked event schema
// - topics[0]: symbol "address_blocked"
// - data: single Address value for the blocked address
// The snapshot harness captures the full event payload (topics and data) for regression.
#[test]
fn emits_address_blocked_event() {
let (env, admin, subject, client) = setup();
client.allow_address(&admin, &subject);
assert!(client.is_allowed(&subject));
client.block_address(&admin, &subject, &None);
assert!(!client.is_allowed(&subject));
// Events are captured by the snapshot test harness; no additional assertions needed here.
let _ = env;
assert_eq!(last_event_symbol(&env), "address_blocked");
}

// Verification: address_cleared event schema
// - topics[0]: symbol "address_cleared"
// - data: single Address value for the cleared address
// The snapshot harness captures the full event payload (topics and data) for regression.
#[test]
fn emits_address_cleared_event() {
let (env, admin, subject, client) = setup();
Expand All @@ -283,8 +278,7 @@ fn emits_address_cleared_event() {
assert!(!client.is_allowed(&subject));
client.clear_address(&admin, &subject);
assert!(client.is_allowed(&subject));
// Events are captured by the snapshot test harness; no additional assertions needed here.
let _ = env;
assert_eq!(last_event_symbol(&env), "address_cleared");
}

// ── #121 Allow/Block/Clear precedence matrix ─────────────────────────────────
Expand Down