Skip to content

Commit

Permalink
Add a negative test for the pool manage case
Browse files Browse the repository at this point in the history
  • Loading branch information
Quantumplation committed May 6, 2024
1 parent 971b046 commit 6fe4535
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions validators/tests/pool.ak
Original file line number Diff line number Diff line change
Expand Up @@ -760,9 +760,9 @@ fn scoop_swap_deposit(options: ScoopTestOptions) {
result
}

fn withdraw_fees_transaction(options: ScoopTestOptions, withdraw_amount: Int) {
fn withdraw_fees_transaction(options: ScoopTestOptions, withdraw_amount: Int, pool_input: Int) {
let withdraw_fees_redeemer =
WithdrawFees { amount: withdraw_amount, treasury_output: 1, pool_input: 1 }
WithdrawFees { amount: withdraw_amount, treasury_output: 1, pool_input: pool_input }
// Note: check that we're looking at the right input by making it not the first input
let pool_nft_name = shared.pool_nft_name(constants.pool_ident)
let default_pool_output_address =
Expand Down Expand Up @@ -914,7 +914,11 @@ fn withdraw_fees_transaction(options: ScoopTestOptions, withdraw_amount: Int) {
}

test withdraw_fees_transaction_test() {
withdraw_fees_transaction(default_scoop_test_options(), 100)
withdraw_fees_transaction(default_scoop_test_options(), 100, 1)
}
test withdraw_fees_transaction_wrong_pool_input() fail {
// Make sure that if we point to a different index, it'll fail
withdraw_fees_transaction(default_scoop_test_options(), 100, 0)
}

test withdraw_fees_transaction_change_pool_staking_address_valid_test() {
Expand All @@ -940,7 +944,7 @@ test withdraw_fees_transaction_change_pool_staking_address_valid_test() {
},
),
}
withdraw_fees_transaction(options, 100)
withdraw_fees_transaction(options, 100, 1)
}

test withdraw_fees_transaction_change_pool_staking_address_invalid_test() fail {
Expand Down Expand Up @@ -968,7 +972,7 @@ test withdraw_fees_transaction_change_pool_staking_address_invalid_test() fail {
},
),
}
withdraw_fees_transaction(options, 100)
withdraw_fees_transaction(options, 100, 1)
}

test overdraw_test() fail {
Expand Down Expand Up @@ -996,7 +1000,7 @@ test overdraw_test() fail {
},
),
}
withdraw_fees_transaction(options, 5_000_000)
withdraw_fees_transaction(options, 5_000_000, 1)
}

fn update_pool_fees_transaction(options: ScoopTestOptions) {
Expand Down

0 comments on commit 6fe4535

Please sign in to comment.