Skip to content

Commit

Permalink
test-suite-nit
Browse files Browse the repository at this point in the history
  • Loading branch information
crypto-vincent committed Sep 18, 2024
1 parent d67a33d commit 2e72ec6
Showing 1 changed file with 43 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async fn test_controller_edit_authority() -> Result<(), program_context::Program

// ---------------------------------------------------------------------
// -- Phase 2
// -- Change the controller fields
// -- Change the controller authority back and forth
// ---------------------------------------------------------------------

let old_authority = authority;
Expand Down Expand Up @@ -80,7 +80,7 @@ async fn test_controller_edit_authority() -> Result<(), program_context::Program
&mut program_context,
&payer,
&old_authority,
&old_authority.pubkey(),
&new_authority.pubkey(),
)
.await
.is_err()
Expand All @@ -95,7 +95,7 @@ async fn test_controller_edit_authority() -> Result<(), program_context::Program
)
.await?;

// The old authority can not use the program anymore
// The old authority can not use the program anymore, but the new one can
assert!(program_uxd::instructions::process_edit_controller(
&mut program_context,
&payer,
Expand All @@ -111,8 +111,6 @@ async fn test_controller_edit_authority() -> Result<(), program_context::Program
)
.await
.is_err());

// The new authority can now use the program
program_uxd::instructions::process_edit_controller(
&mut program_context,
&payer,
Expand All @@ -128,6 +126,46 @@ async fn test_controller_edit_authority() -> Result<(), program_context::Program
)
.await?;

// The new authority can send the authority again back to the old one
program_uxd::instructions::process_edit_controller_authority(
&mut program_context,
&payer,
&new_authority,
&old_authority.pubkey(),
)
.await?;

// The new authority can not use the program anymore, but the old one can
assert!(program_uxd::instructions::process_edit_controller(
&mut program_context,
&payer,
&new_authority,
&EditControllerFields {
redeemable_global_supply_cap: None,
depositories_routing_weight_bps: None,
router_depositories: None,
outflow_limit_per_epoch_amount: None,
outflow_limit_per_epoch_bps: None,
slots_per_epoch: None,
},
)
.await
.is_err());
program_uxd::instructions::process_edit_controller(
&mut program_context,
&payer,
&old_authority,
&EditControllerFields {
redeemable_global_supply_cap: None,
depositories_routing_weight_bps: None,
router_depositories: None,
outflow_limit_per_epoch_amount: None,
outflow_limit_per_epoch_bps: None,
slots_per_epoch: None,
},
)
.await?;

// Done
Ok(())
}

0 comments on commit 2e72ec6

Please sign in to comment.