Skip to content

Commit

Permalink
try using cargo fmt to fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-c-child committed Feb 8, 2024
1 parent 9e41bfc commit ec57129
Showing 1 changed file with 50 additions and 32 deletions.
82 changes: 50 additions & 32 deletions contracts/whitelist-updatable-flatrate/src/integration_tests.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#[cfg(test)]
mod tests {
use crate::{ msg::*, state::Config };
use crate::{msg::*, state::Config};

use cosmwasm_std::Addr;
use name_minter::msg::InstantiateMsg as NameMinterInstantiateMsg;
use sg_std::StargazeMsgWrapper;

use cw_multi_test::{ Contract, ContractWrapper, Executor };
use cw_multi_test::{Contract, ContractWrapper, Executor};

use sg_multi_test::StargazeApp;

Expand All @@ -23,7 +23,7 @@ mod tests {
let contract = ContractWrapper::new(
crate::contract::execute,
crate::contract::instantiate,
crate::contract::query
crate::contract::query,
);
Box::new(contract)
}
Expand All @@ -32,7 +32,7 @@ mod tests {
let contract = ContractWrapper::new(
sg721_name::entry::execute,
sg721_name::entry::instantiate,
sg721_name::entry::query
sg721_name::entry::query,
);
Box::new(contract)
}
Expand All @@ -41,10 +41,10 @@ mod tests {
let contract = ContractWrapper::new(
name_minter::contract::execute,
name_minter::contract::instantiate,
name_minter::query::query
name_minter::query::query,
)
.with_reply(name_minter::contract::reply)
.with_sudo(name_minter::sudo::sudo);
.with_reply(name_minter::contract::reply)
.with_sudo(name_minter::sudo::sudo);
Box::new(contract)
}

Expand All @@ -69,7 +69,7 @@ mod tests {
"addr0002".to_string(),
"addr0003".to_string(),
"addr0004".to_string(),
"addr0005".to_string()
"addr0005".to_string(),
];

let msg = InstantiateMsg {
Expand All @@ -91,7 +91,7 @@ mod tests {
&msg,
&[],
"wl-contract".to_string(),
None
None,
)
.unwrap();

Expand All @@ -104,7 +104,7 @@ mod tests {
&msg,
&[],
"name-minter-contract".to_string(),
None
None,
)
.unwrap();

Expand All @@ -126,7 +126,7 @@ mod tests {
&wl_addr,
&(QueryMsg::IncludesAddress {
address: addrs[0].clone(),
})
}),
)
.unwrap();
assert!(includes);
Expand All @@ -137,7 +137,7 @@ mod tests {
&wl_addr,
&(QueryMsg::MintCount {
address: addrs[0].clone(),
})
}),
)
.unwrap();
assert_eq!(count, 0);
Expand Down Expand Up @@ -168,7 +168,7 @@ mod tests {
&wl_addr,
&(QueryMsg::MintCount {
address: addrs[0].clone(),
})
}),
)
.unwrap();
assert_eq!(res, 1);
Expand All @@ -181,7 +181,7 @@ mod tests {
"addr0002".to_string(),
"addr0003".to_string(),
"addr0004".to_string(),
"addr0005".to_string()
"addr0005".to_string(),
];

let msg = InstantiateMsg {
Expand All @@ -203,7 +203,7 @@ mod tests {
&msg,
&[],
"wl-contract".to_string(),
None
None,
)
.unwrap();

Expand All @@ -216,7 +216,7 @@ mod tests {
&msg,
&[],
"name-minter-contract".to_string(),
None
None,
)
.unwrap();

Expand All @@ -240,7 +240,7 @@ mod tests {
"addr0002".to_string(),
"addr0003".to_string(),
"addr0004".to_string(),
"addr0006".to_string()
"addr0006".to_string(),
],
};
let res = app.execute_contract(Addr::unchecked(OTHER_ADMIN), wl_addr.clone(), &msg, &[]);
Expand All @@ -251,11 +251,14 @@ mod tests {
&wl_addr,
&(QueryMsg::IncludesAddress {
address: "addr0006".to_string(),
})
}),
)
.unwrap();
assert!(!res);
let res: u64 = app.wrap().query_wasm_smart(&wl_addr, &(QueryMsg::AddressCount {})).unwrap();
let res: u64 = app
.wrap()
.query_wasm_smart(&wl_addr, &(QueryMsg::AddressCount {}))
.unwrap();
assert_eq!(res, 5);
let msg = ExecuteMsg::AddAddresses {
addresses: vec!["addr0007".to_string(), "addr0006".to_string()],
Expand All @@ -268,11 +271,14 @@ mod tests {
&wl_addr,
&(QueryMsg::IncludesAddress {
address: "addr0006".to_string(),
})
}),
)
.unwrap();
assert!(res);
let res: u64 = app.wrap().query_wasm_smart(&wl_addr, &(QueryMsg::AddressCount {})).unwrap();
let res: u64 = app
.wrap()
.query_wasm_smart(&wl_addr, &(QueryMsg::AddressCount {}))
.unwrap();
assert_eq!(res, 7);

// remove addresses
Expand All @@ -283,7 +289,7 @@ mod tests {
"addr0002".to_string(),
"addr0003".to_string(),
"addr0004".to_string(),
"addr0006".to_string()
"addr0006".to_string(),
],
};
let res = app.execute_contract(Addr::unchecked(OTHER_ADMIN), wl_addr.clone(), &msg, &[]);
Expand All @@ -294,7 +300,7 @@ mod tests {
"addr0002".to_string(),
"addr0003".to_string(),
"addr0004".to_string(),
"addr0006".to_string()
"addr0006".to_string(),
],
};
let res = app.execute_contract(Addr::unchecked(OTHER_ADMIN), wl_addr.clone(), &msg, &[]);
Expand All @@ -305,11 +311,14 @@ mod tests {
&wl_addr,
&(QueryMsg::IncludesAddress {
address: "addr0006".to_string(),
})
}),
)
.unwrap();
assert!(!res);
let res: u64 = app.wrap().query_wasm_smart(&wl_addr, &(QueryMsg::AddressCount {})).unwrap();
let res: u64 = app
.wrap()
.query_wasm_smart(&wl_addr, &(QueryMsg::AddressCount {}))
.unwrap();
assert_eq!(res, 2);

// per address limit
Expand Down Expand Up @@ -337,7 +346,7 @@ mod tests {
&wl_addr,
&(QueryMsg::IsProcessable {
address: "addr0007".to_string(),
})
}),
)
.unwrap();
assert!(res);
Expand All @@ -348,7 +357,7 @@ mod tests {
Addr::unchecked(minter_addr.clone()),
wl_addr.clone(),
&msg,
&[]
&[],
);
assert!(res.is_ok());
let res: bool = app
Expand All @@ -357,7 +366,7 @@ mod tests {
&wl_addr,
&(QueryMsg::IsProcessable {
address: "addr0007".to_string(),
})
}),
)
.unwrap();
assert!(!res);
Expand All @@ -371,7 +380,10 @@ mod tests {
let msg = ExecuteMsg::Purge {};
let res = app.execute_contract(Addr::unchecked(OTHER_ADMIN), wl_addr.clone(), &msg, &[]);
assert!(res.is_ok());
let res: u32 = app.wrap().query_wasm_smart(&wl_addr, &(QueryMsg::AddressCount {})).unwrap();
let res: u32 = app
.wrap()
.query_wasm_smart(&wl_addr, &(QueryMsg::AddressCount {}))
.unwrap();
assert_eq!(res, 0);
// does not include addr0007
let res: bool = app
Expand All @@ -380,14 +392,20 @@ mod tests {
&wl_addr,
&(QueryMsg::IncludesAddress {
address: "addr0007".to_string(),
})
}),
)
.unwrap();
assert!(!res);

// query config
let res: Config = app.wrap().query_wasm_smart(&wl_addr, &(QueryMsg::Config {})).unwrap();
assert_eq!(res.admins, vec![OTHER_ADMIN.to_string(), TEMP_ADMIN.to_string()]);
let res: Config = app
.wrap()
.query_wasm_smart(&wl_addr, &(QueryMsg::Config {}))
.unwrap();
assert_eq!(
res.admins,
vec![OTHER_ADMIN.to_string(), TEMP_ADMIN.to_string()]
);
assert_eq!(res.per_address_limit, new_per_address_limit);
}

Expand Down

0 comments on commit ec57129

Please sign in to comment.