Skip to content

Commit

Permalink
Fix up integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeHartnell committed Sep 11, 2023
1 parent cc764d0 commit 87aaf6d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cosmwasm_std::{Coin, Uint128};
use cw_tokenfactory_issuer::msg::DenomUnit;
use dao_voting::threshold::ActiveThreshold;
use dao_voting::threshold::{ActiveThreshold, ActiveThresholdError};
use osmosis_std::types::cosmos::bank::v1beta1::QueryBalanceRequest;
use osmosis_test_tube::{Account, OsmosisTestApp};

Expand Down Expand Up @@ -81,8 +81,8 @@ fn test_instantiate_no_dao_balance() {
let vp_contract = env
.instantiate(
&InstantiateMsg {
token_issuer_code_id: tf_issuer_id,
token_info: TokenInfo::New(NewTokenInfo {
token_issuer_code_id: tf_issuer_id,
subdenom: "ucat".to_string(),
metadata: Some(NewDenomMetadata {
description: "Awesome token, get it meow!".to_string(),
Expand Down Expand Up @@ -144,8 +144,8 @@ fn test_instantiate_no_metadata() {

env.instantiate(
&InstantiateMsg {
token_issuer_code_id: tf_issuer_id,
token_info: TokenInfo::New(NewTokenInfo {
token_issuer_code_id: tf_issuer_id,
subdenom: "ucat".to_string(),
metadata: None,
initial_balances: vec![InitialBalance {
Expand Down Expand Up @@ -174,8 +174,8 @@ fn test_instantiate_invalid_metadata_fails() {

env.instantiate(
&InstantiateMsg {
token_issuer_code_id: tf_issuer_id,
token_info: TokenInfo::New(NewTokenInfo {
token_issuer_code_id: tf_issuer_id,
subdenom: "cat".to_string(),
metadata: Some(NewDenomMetadata {
description: "Awesome token, get it meow!".to_string(),
Expand Down Expand Up @@ -216,8 +216,8 @@ fn test_instantiate_invalid_active_threshold_count_fails() {
let err = env
.instantiate(
&InstantiateMsg {
token_issuer_code_id: tf_issuer_id,
token_info: TokenInfo::New(NewTokenInfo {
token_issuer_code_id: tf_issuer_id,
subdenom: "cat".to_string(),
metadata: Some(NewDenomMetadata {
description: "Awesome token, get it meow!".to_string(),
Expand Down Expand Up @@ -248,7 +248,9 @@ fn test_instantiate_invalid_active_threshold_count_fails() {

assert_eq!(
err,
TfDaoVotingContract::execute_submessage_error(ContractError::InvalidAbsoluteCount {})
TfDaoVotingContract::execute_submessage_error(ContractError::ActiveThresholdError(
ActiveThresholdError::InvalidAbsoluteCount {}
))
);
}

Expand All @@ -264,8 +266,8 @@ fn test_instantiate_no_initial_balances_fails() {
let err = env
.instantiate(
&InstantiateMsg {
token_issuer_code_id: tf_issuer_id,
token_info: TokenInfo::New(NewTokenInfo {
token_issuer_code_id: tf_issuer_id,
subdenom: "ucat".to_string(),
metadata: Some(NewDenomMetadata {
description: "Awesome token, get it meow!".to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ impl TestEnvBuilder {
let vp_contract = TfDaoVotingContract::deploy(
app,
&InstantiateMsg {
token_issuer_code_id: issuer_id,
token_info: TokenInfo::New(NewTokenInfo {
token_issuer_code_id: issuer_id,
subdenom: DENOM.to_string(),
metadata: Some(crate::msg::NewDenomMetadata {
description: "Awesome token, get it meow!".to_string(),
Expand Down Expand Up @@ -172,14 +172,18 @@ impl TestEnvBuilder {
let issuer_addr =
TfDaoVotingContract::query(&vp_contract, &QueryMsg::TokenContract {}).unwrap();

let tf_issuer = TokenfactoryIssuer::new_with_values(
app,
self.instantiate_msg
.expect("instantiate msg not set")
.token_issuer_code_id,
issuer_addr,
)
.unwrap();
let issuer_id: u64;
if let TokenInfo::New(token) = self
.instantiate_msg
.expect("instantiate msg not set")
.token_info
{
issuer_id = token.token_issuer_code_id;
} else {
panic!("TokenInfo is not New");
}

let tf_issuer = TokenfactoryIssuer::new_with_values(app, issuer_id, issuer_addr).unwrap();

TestEnv {
app,
Expand Down

0 comments on commit 87aaf6d

Please sign in to comment.