From 7c25ed2ba4be71b9bbed1f68908e39f4a5c4a2c9 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Sat, 30 Nov 2024 19:25:21 +0000 Subject: Fixes AB transaction query tests in light of ActualbudgetDate.to_iso() change --- .../tests/common/transaction_matchers.rs | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'rust/actualbudget_queries/tests/common/transaction_matchers.rs') diff --git a/rust/actualbudget_queries/tests/common/transaction_matchers.rs b/rust/actualbudget_queries/tests/common/transaction_matchers.rs index 9613b3f..2620da5 100644 --- a/rust/actualbudget_queries/tests/common/transaction_matchers.rs +++ b/rust/actualbudget_queries/tests/common/transaction_matchers.rs @@ -53,7 +53,7 @@ fn matches_bank_account_initial_transaction( .. } => *account_id == bank_account_id && *category_id == starting_balances_category_id - && date.to_iso() == "2024-08-01", + && date.to_iso().get(0..10) == Some("2024-08-01"), _ => false, } } @@ -87,7 +87,7 @@ fn matches_cash_account_initial_transaction( .. } => *account_id == bank_account_id && *category_id == starting_balances_category_id - && date.to_iso() == "2024-08-01", + && date.to_iso().get(0..10) == Some("2024-08-01"), _ => false, } } @@ -121,10 +121,11 @@ fn matches_income_transaction( date, notes: Some(notes), .. - } => *account_id == bank_account_id - && *category_id == Some(income_category_id) - && date.to_iso() == format!("2024-{}-21", month) - && *notes == String::from("Salary"), + } => + *account_id == bank_account_id + && *category_id == Some(income_category_id) + && date.to_iso().get(0..10) == Some(format!("2024-{}-21", month).as_str()) + && *notes == String::from("Salary"), _ => false, } } @@ -159,7 +160,7 @@ fn matches_food_transaction( .. } => *account_id == bank_account_id && *category_id == Some(income_category_id) - && date.to_iso() == format!("2024-{}-08", month), + && date.to_iso().get(0..10) == Some(format!("2024-{}-08", month).as_str()), _ => false, } } @@ -186,7 +187,7 @@ fn matches_category_transfer_parent_transaction( date, .. } => *account_id == category_transfers_account_id - && date.to_iso() == "2024-10-23", + && date.to_iso().get(0..10) == Some("2024-10-23"), _ => false, } } @@ -220,7 +221,7 @@ fn matches_category_transfer_child_out_transaction( .. } => *account_id == category_transfers_account_id && *category_id == savings_category_id - && date.to_iso() == "2024-10-23", + && date.to_iso().get(0..10) == Some("2024-10-23"), _ => false, } } @@ -254,7 +255,7 @@ fn matches_category_transfer_child_in_transaction( .. } => *account_id == category_transfers_account_id && *category_id == savings_category_id - && date.to_iso() == "2024-10-23", + && date.to_iso().get(0..10) == Some("2024-10-23"), _ => false, } } @@ -281,7 +282,7 @@ fn matches_account_transfer_out_transaction( date, .. } => *account_id == bank_account_id - && date.to_iso() == "2024-09-10", + && date.to_iso().get(0..10) == Some("2024-09-10"), _ => false, } } @@ -308,7 +309,7 @@ fn matches_account_transfer_in_transaction( date, .. } => *account_id == cash_account_id - && date.to_iso() == "2024-09-10", + && date.to_iso().get(0..10) == Some("2024-09-10"), _ => false, } } -- cgit v1.2.3