-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9bfb00f
commit 7f3e6cf
Showing
14 changed files
with
14,593 additions
and
2,716 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
pub mod contract; | ||
pub mod state; | ||
|
||
#[cfg(test)] | ||
pub mod tests; |
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,30 @@ | ||
use cosmwasm_std::testing::{mock_dependencies, mock_env, mock_info}; | ||
use cosmwasm_std::{attr, from_binary}; | ||
|
||
use protocol_cosmwasm::signature_bridge::StateResponse; | ||
use protocol_cosmwasm::signature_bridge::{InstantiateMsg, QueryMsg}; | ||
|
||
use super::contract::{instantiate, query}; | ||
|
||
const GOVERNOR: [u8; 33] = [0u8; 33]; | ||
|
||
#[test] | ||
fn proper_initialization() { | ||
let mut deps = mock_dependencies(); | ||
|
||
let msg = InstantiateMsg { | ||
initial_governor: GOVERNOR.to_vec(), | ||
}; | ||
let info = mock_info("creator", &[]); | ||
|
||
// we can just call .unwrap() to assert this was a success | ||
let res = instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); | ||
assert_eq!(0, res.messages.len()); | ||
assert_eq!(res.attributes, vec![attr("method", "instantiate"),]); | ||
|
||
// it worked, let's query the state | ||
let res = query(deps.as_ref(), mock_env(), QueryMsg::GetState {}).unwrap(); | ||
let state: StateResponse = from_binary(&res).unwrap(); | ||
assert_eq!(state.governor, GOVERNOR.to_vec()); | ||
assert_eq!(state.proposal_nonce, 0); | ||
} |
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
Oops, something went wrong.