From 4865275d95c791ff3269e770337d2a3b9250f1a6 Mon Sep 17 00:00:00 2001 From: Reisen Date: Tue, 7 Sep 2021 14:27:36 +0000 Subject: [PATCH] solana/token_bridge: check balance and truncation Change-Id: I59837374067350885b70f4b090ac4ba7a1e37d3e --- .../token_bridge/program/tests/integration.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/solana/modules/token_bridge/program/tests/integration.rs b/solana/modules/token_bridge/program/tests/integration.rs index 9495f308..e7986fc0 100644 --- a/solana/modules/token_bridge/program/tests/integration.rs +++ b/solana/modules/token_bridge/program/tests/integration.rs @@ -43,7 +43,7 @@ use solitaire::{ processors::seeded::Seeded, AccountState, }; -use spl_token::state::Mint; +use spl_token::state::{Account, Mint}; use std::{ convert::TryInto, io::{ @@ -794,6 +794,19 @@ fn test_transfer_in_wrapped_preexisting(context: &mut Context) { payer, ) .unwrap(); + + let account_data = Account::unpack( + &client + .get_account_with_commitment(&external_token_account.pubkey(), CommitmentConfig::processed()) + .unwrap() + .value + .unwrap() + .data, + ) + .unwrap(); + + // Check truncation for external asset shrinks by the correct amount. + assert_eq!(1000, account_data.amount); } fn test_transfer_wrapped_preexisting(context: &mut Context) {