diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..3c71b3b2 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,13 @@ +{ + "image": "ghcr.io/near/near-devcontainer:latest", + "customizations": { + "vscode": { + "extensions": [ + "dtsvet.vscode-wasm", + "rust-lang.rust-analyzer", + "github.vscode-github-actions" + ] + } + }, + "postCreateCommand": "./.devcontainer/post-create.sh" +} diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100755 index 00000000..e9d1ebb7 --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +(cd discussions && cargo near build) +(cd community && cargo near build) +(cd community-factory && cargo near build) +cargo near build diff --git a/tests/proposals.rs b/tests/proposals.rs index c2b05394..3ac4096f 100644 --- a/tests/proposals.rs +++ b/tests/proposals.rs @@ -8,7 +8,7 @@ use {crate::test_env::*, serde_json::json}; async fn test_proposal() -> anyhow::Result<()> { // Initialize the devhub and near social contract on chain, // contract is devhub contract instance. - let (contract, worker, ..) = init_contracts_from_res().await?; + let (contract, worker, near_social) = init_contracts_from_res().await?; let deposit_amount = NearToken::from_near(2); @@ -52,6 +52,18 @@ async fn test_proposal() -> anyhow::Result<()> { get_proposal["social_db_post_block_height"].as_str().unwrap().parse::()?; assert!(social_db_post_block_height > 0); + let first_proposal_social_post = String::from_utf8( + near_social + .call("get") + .args_json(json!({"keys": [format!("{}/post/main", contract.id())]})) + .view() + .await? + .result, + ) + .unwrap(); + + assert_eq!(first_proposal_social_post, "{\"devhub.near\":{\"post\":{\"main\":\"{\\\"type\\\":\\\"md\\\",\\\"text\\\":\\\"There is a new proposal on DevHub from @devhub.near: “another post“\\\\n> sum\\\\n__Read the full proposal [here](/devhub.near/widget/app?page=proposal&id=0)__\\\"}\"}}}"); + let _edit_proposal_category = contract .call("edit_proposal") .args_json(json!({ @@ -169,6 +181,18 @@ async fn test_proposal() -> anyhow::Result<()> { .transact() .await?; + let second_proposal_social_post = String::from_utf8( + near_social + .call("get") + .args_json(json!({"keys": [format!("{}/post/main", contract.id())]})) + .view() + .await? + .result, + ) + .unwrap(); + + assert_eq!(second_proposal_social_post, "{\"devhub.near\":{\"post\":{\"main\":\"{\\\"type\\\":\\\"md\\\",\\\"text\\\":\\\"There is a new proposal on DevHub from @second.test.near: “another author“\\\\n> sum\\\\n__Read the full proposal [here](/devhub.near/widget/app?page=proposal&id=2)__\\\"}\"}}}"); + let get_second_author_proposal: serde_json::Value = contract .call("get_proposal") .args_json(json!({