Skip to content

Commit

Permalink
test: Pausable except works when ALL is paused (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
mooori authored Dec 14, 2022
1 parent e6c52e3 commit cdd2ea3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions near-plugins/src/pausable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,23 @@ mod tests {
assert_eq!(counter.counter, 0);
}

/// Verify `except` escape hatch works when the feature is paused via `ALL`.
#[test]
fn test_pause_with_all_allows_except() {
let (mut counter, mut ctx) = setup_basic();

// Pause `ALL`.
ctx.predecessor_account_id = "anna.test".to_string().try_into().unwrap();
testing_env!(ctx.clone());
counter.pa_pause_feature("ALL".to_string());

// Call paused function from exempted account.
ctx.predecessor_account_id = "brenda.test".to_string().try_into().unwrap();
testing_env!(ctx.clone());
counter.increase_4();
assert_eq!(counter.counter, 4);
}

#[test]
fn test_not_paused_with_different_key() {
let (mut counter, mut ctx) = setup_basic();
Expand Down

0 comments on commit cdd2ea3

Please sign in to comment.