Skip to content

Commit

Permalink
feat: add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ericnordelo committed Nov 19, 2024
1 parent bb21021 commit e613e48
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ pub mod GovernorSettingsComponent {
/// NOTE: This function does not emit an event if the new voting delay is the same as the
/// old one.
///
/// Requirements:
///
/// - Caller must be the governance executor.
///
/// May emit a `VotingDelayUpdated` event.
fn set_voting_delay(ref self: ComponentState<TContractState>, new_voting_delay: u64) {
self.assert_only_governance();
Expand All @@ -124,6 +128,7 @@ pub mod GovernorSettingsComponent {
///
/// Requirements:
///
/// - Caller must be the governance executor.
/// - `new_voting_period` must be greater than 0.
///
/// May emit a `VotingPeriodUpdated` event.
Expand All @@ -137,6 +142,10 @@ pub mod GovernorSettingsComponent {
/// NOTE: This function does not emit an event if the new proposal threshold is the same as
/// the old one.
///
/// Requirements:
///
/// - Caller must be the governance executor.
///
/// May emit a `ProposalThresholdUpdated` event.
fn set_proposal_threshold(
ref self: ComponentState<TContractState>, new_proposal_threshold: u256
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,10 @@ fn test_initializer() {
mock_state.governor_settings.initializer(15, 45, 100);

assert_eq!(GovernorSettings::voting_delay(component_state), 15);
spy.assert_only_event_voting_delay_updated(test_address(), 0, 15);
spy.assert_event_voting_delay_updated(test_address(), 0, 15);

assert_eq!(GovernorSettings::voting_period(component_state), 45);
spy.assert_only_event_voting_period_updated(test_address(), 0, 45);
spy.assert_event_voting_period_updated(test_address(), 0, 45);

assert_eq!(GovernorSettings::proposal_threshold(component_state), 100);
spy.assert_only_event_proposal_threshold_updated(test_address(), 0, 100);
Expand Down

0 comments on commit e613e48

Please sign in to comment.