-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add common test_basics_on between new template and test
- Loading branch information
dj8yf0μl
committed
Oct 22, 2024
1 parent
f9b7660
commit 9f9ac14
Showing
5 changed files
with
65 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
async fn test_basics_on(contract_wasm: &[u8]) -> Result<(), Box<dyn std::error::Error>> { | ||
let sandbox = near_workspaces::sandbox().await?; | ||
let contract = sandbox.dev_deploy(&contract_wasm).await?; | ||
|
||
let user_account = sandbox.dev_create_account().await?; | ||
|
||
let outcome = user_account | ||
.call(contract.id(), "set_greeting") | ||
.args_json(json!({"greeting": "Hello World!"})) | ||
.transact() | ||
.await?; | ||
assert!(outcome.is_success()); | ||
|
||
let user_message_outcome = contract.view("get_greeting").args_json(json!({})).await?; | ||
assert_eq!(user_message_outcome.json::<String>()?, "Hello World!"); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters