diff --git a/zingolib/src/wallet/transaction_record.rs b/zingolib/src/wallet/transaction_record.rs index a6d0739a7..2801dda2f 100644 --- a/zingolib/src/wallet/transaction_record.rs +++ b/zingolib/src/wallet/transaction_record.rs @@ -88,6 +88,7 @@ impl TransactionRecord { } } } + // much data assignment of this struct is done through the pub fields as of january 2024. Todo: should have private fields and public methods. } //get impl TransactionRecord { @@ -342,3 +343,31 @@ impl TransactionRecord { Ok(()) } } + +#[cfg(test)] +mod tests { + use crate::wallet::utils::txid_from_slice; + + use super::*; + + #[test] + pub fn blank_record() { + let new = TransactionRecord::new( + ConfirmationStatus::Confirmed(2_000_000.into()), + 103, + &txid_from_slice(&[0u8; 32]), + ); + assert_eq!(new.get_transparent_value_spent(), 0); + assert_eq!(new.get_transaction_fee().unwrap(), 0); + assert_eq!(new.is_outgoing_transaction(), false); + assert_eq!(new.is_incoming_transaction(), false); + // assert_eq!(new.net_spent(), 0); + assert_eq!(new.pool_change_returned::(), 0); + assert_eq!(new.pool_change_returned::>(), 0); + assert_eq!(new.total_value_received(), 0); + assert_eq!(new.total_value_spent(), 0); + assert_eq!(new.value_outgoing(), 0); + let t: [u64; 3] = [0, 0, 0]; + assert_eq!(new.value_spent_by_pool(), t); + } +}