Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -756,3 +756,5 @@ For comprehensive integration examples, see the `examples/` directory in the rep
- Rust client (`examples/rust_client_example.rs`)
- JavaScript client (`examples/javascript_client_example.js`)
- CLI examples (`examples/cli_usage_examples.sh`)

<!-- Updated documentation references -->
23 changes: 17 additions & 6 deletions tests/unit/token_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -891,8 +891,6 @@ mod token_unit_tests {
#[test]
#[should_panic(expected = "no snapshot available at specified ledger")]
fn test_vote_rejects_missing_snapshot_instead_of_using_current_balance() {
#[should_panic(expected = "contract is paused")]
fn test_create_proposal_fails_while_paused() {
let env = Env::default();
let (admin, contract_id, _) = setup_token(&env);
let client = LearnTokenClient::new(&env, &contract_id);
Expand Down Expand Up @@ -928,18 +926,29 @@ mod token_unit_tests {
&0,
&1_000,
&100,
);
}

#[test]
#[should_panic(expected = "contract is paused")]
fn test_create_proposal_fails_while_paused() {
let env = Env::default();
let (admin, contract_id, _) = setup_token(&env);
let client = LearnTokenClient::new(&env, &contract_id);
env.mock_all_auths();
env.ledger().with_mut(|l| l.sequence_number = 100);

client.pause(&admin);
client.create_proposal(
&SorobanString::from_str(&env, "Paused proposal"),
&2,
&0,
&100,
&env.ledger().sequence(),
&50,
);
}

#[test]
fn test_vesting_schedule_cliff_linear_vesting_and_claiming() {
#[should_panic(expected = "contract is paused")]
fn test_vote_fails_while_paused() {
let env = Env::default();
Expand All @@ -948,12 +957,13 @@ mod token_unit_tests {
let voter = Address::generate(&env);
env.mock_all_auths();
client.mint(&admin, &voter, &100);
env.ledger().with_mut(|l| l.sequence_number = 100);
let proposal_id = client.create_proposal(
&SorobanString::from_str(&env, "Paused vote"),
&2,
&0,
&100,
&env.ledger().sequence(),
&99,
);
client.pause(&admin);
client.vote(&voter, &proposal_id, &0);
Expand All @@ -966,12 +976,13 @@ mod token_unit_tests {
let (admin, contract_id, _) = setup_token(&env);
let client = LearnTokenClient::new(&env, &contract_id);
env.mock_all_auths();
env.ledger().with_mut(|l| l.sequence_number = 100);
let proposal_id = client.create_proposal(
&SorobanString::from_str(&env, "Paused execution"),
&2,
&0,
&100,
&env.ledger().sequence(),
&99,
);
env.ledger().with_mut(|ledger| ledger.timestamp = 100);
client.pause(&admin);
Expand Down