fix tests for escrow
This commit is contained in:
parent
871e26edc2
commit
9e3a39545d
@ -228,9 +228,6 @@ async fn test_register_operator() {
|
|||||||
let brain_channel = run_service_for_stream().await.unwrap();
|
let brain_channel = run_service_for_stream().await.unwrap();
|
||||||
let key = Key::new();
|
let key = Key::new();
|
||||||
|
|
||||||
let min_escrew_error = register_operator(&brain_channel, &key, 10).await.err().unwrap();
|
|
||||||
assert!(min_escrew_error.to_string().contains("Minimum escrow amount is 5000"));
|
|
||||||
|
|
||||||
let no_balance =
|
let no_balance =
|
||||||
register_operator(&brain_channel, &key, 5000 * TOKEN_DECIMAL).await.err().unwrap();
|
register_operator(&brain_channel, &key, 5000 * TOKEN_DECIMAL).await.err().unwrap();
|
||||||
assert!(no_balance.to_string().contains("Insufficient funds, deposit more tokens"));
|
assert!(no_balance.to_string().contains("Insufficient funds, deposit more tokens"));
|
||||||
@ -243,7 +240,7 @@ async fn test_register_operator() {
|
|||||||
|
|
||||||
airdrop(&brain_channel, &key.pubkey, 7000).await.unwrap();
|
airdrop(&brain_channel, &key.pubkey, 7000).await.unwrap();
|
||||||
|
|
||||||
register_operator(&brain_channel, &key, 6000 * TOKEN_DECIMAL).await.unwrap();
|
register_operator(&brain_channel, &key, 6000).await.unwrap();
|
||||||
|
|
||||||
let operator_account: Option<db::Account> =
|
let operator_account: Option<db::Account> =
|
||||||
db_conn.select((ACCOUNT, key.pubkey)).await.unwrap();
|
db_conn.select((ACCOUNT, key.pubkey)).await.unwrap();
|
||||||
@ -362,11 +359,11 @@ async fn test_slash_operator() {
|
|||||||
let op_key = Key::new();
|
let op_key = Key::new();
|
||||||
|
|
||||||
let admin = admin_keys()[0].clone();
|
let admin = admin_keys()[0].clone();
|
||||||
let escrew = 5500;
|
let escrow = 5500;
|
||||||
let slash_amt = 2500;
|
let slash_amt = 2500;
|
||||||
|
|
||||||
airdrop(&brain_channel, &op_key.pubkey, 10000).await.unwrap();
|
airdrop(&brain_channel, &op_key.pubkey, 10000).await.unwrap();
|
||||||
register_operator(&brain_channel, &op_key, escrew * TOKEN_DECIMAL).await.unwrap();
|
register_operator(&brain_channel, &op_key, escrow).await.unwrap();
|
||||||
|
|
||||||
let raw_slash_req = SlashReq { pubkey: op_key.pubkey.clone(), tokens: 2500 * TOKEN_DECIMAL };
|
let raw_slash_req = SlashReq { pubkey: op_key.pubkey.clone(), tokens: 2500 * TOKEN_DECIMAL };
|
||||||
|
|
||||||
@ -388,7 +385,7 @@ async fn test_slash_operator() {
|
|||||||
db_conn.select((ACCOUNT, op_key.pubkey)).await.unwrap();
|
db_conn.select((ACCOUNT, op_key.pubkey)).await.unwrap();
|
||||||
assert!(operator_account.is_some());
|
assert!(operator_account.is_some());
|
||||||
let account = operator_account.unwrap();
|
let account = operator_account.unwrap();
|
||||||
assert_eq!(account.escrow, (escrew - slash_amt) * TOKEN_DECIMAL);
|
assert_eq!(account.escrow, (escrow - slash_amt) * TOKEN_DECIMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
Loading…
Reference in New Issue
Block a user