Skip to content
Open
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
21 changes: 21 additions & 0 deletions contracts/escrow/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,27 @@ fn test_initialize_emits_event() {
assert_eq!(ev_admin, admin);
}

#[test]
fn test_empty_game_id_rejected() {
let env = Env::default();
env.mock_all_auths();

let admin = Address::generate(&env);
let oracle = Address::generate(&env);

let contract_id = env.register_contract(None, EscrowContract);
let client = EscrowContractClient::new(&env, &contract_id);

// initialize contract first (very important)
client.initialize(&oracle, &admin);

// call with empty game_id
let result = client.try_create_match(&"".into());

// assert error
assert_eq!(result, Err(Error::InvalidGameId));
}

#[test]
fn test_is_initialized_false_before_initialize_and_true_after() {
let env = Env::default();
Expand Down