From 6326386f425e04a559d5be8c27004992665dac5e Mon Sep 17 00:00:00 2001 From: Vadim Volodin Date: Tue, 28 May 2024 19:13:35 +0800 Subject: [PATCH] fix: fix migration test by reducing gas for repost (#118) --- src/repost.rs | 2 +- tests/proposals.rs | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/repost.rs b/src/repost.rs index 9c4fad65..31d6d858 100644 --- a/src/repost.rs +++ b/src/repost.rs @@ -48,7 +48,7 @@ fn repost_internal(post: Post, contract_address: AccountId) -> near_sdk::serde_j pub fn repost(post: Post) -> Promise { social_db_contract() - .with_static_gas(env::prepaid_gas().saturating_div(3)) + .with_static_gas(env::prepaid_gas().saturating_div(4)) .with_attached_deposit(env::attached_deposit()) .set(repost_internal(post, env::current_account_id())) } diff --git a/tests/proposals.rs b/tests/proposals.rs index bc935705..2349203f 100644 --- a/tests/proposals.rs +++ b/tests/proposals.rs @@ -12,6 +12,26 @@ async fn test_proposal() -> anyhow::Result<()> { let deposit_amount = NearToken::from_near(2); + let add_idea_post = contract + .call("add_post") + .args_json(json!({ + "parent_id": null, + "labels": [], + "body": { + "name": "This is a test idea.", + "description": "This is a test description.", + "post_type": "Idea", + "idea_version": "V1" + } + })) + .deposit(deposit_amount) + .transact() + .await?; + + println!("add idea post: {:?}", add_idea_post); + assert!(add_idea_post.is_success()); + + let _set_categories = contract .call("set_allowed_categories") .args_json(json!({"new_categories": ["Marketing", "Events"]}))