Skip to content

Commit

Permalink
Make view method pausable
Browse files Browse the repository at this point in the history
  • Loading branch information
karim-en committed Sep 10, 2024
1 parent eff928f commit 18e50b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions near-plugins-derive/tests/contracts/pausable/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ impl Counter {
}

/// Returns the value of the counter.
#[pause]
pub fn get_counter(&self) -> u64 {
self.counter
}
Expand Down
12 changes: 12 additions & 0 deletions near-plugins-derive/tests/pausable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,18 @@ async fn test_not_paused_with_different_key() -> anyhow::Result<()> {
Ok(())
}

#[tokio::test]
async fn test_view_call_of_pausable_method() -> anyhow::Result<()> {
let setup = Setup::new().await?;
let res = setup
.call_counter_modifier(&setup.unauth_account, "increase_1")
.await?;
assert_success_with_unit_return(res);
assert_eq!(setup.get_counter().await?, 1);

Ok(())
}

#[tokio::test]
async fn test_work_after_unpause() -> anyhow::Result<()> {
let setup = Setup::new().await?;
Expand Down

0 comments on commit 18e50b5

Please sign in to comment.