summaryrefslogtreecommitdiff
path: root/actualbudget_to_schist_transformer/tests/run.rs
diff options
context:
space:
mode:
authorJoe Carstairs <jcarstairs@scottlogic.com>2025-07-28 13:22:53 +0100
committerJoe Carstairs <jcarstairs@scottlogic.com>2025-07-28 13:30:27 +0100
commit2361adeb0ca77904138e3466d51c2f44cf6df613 (patch)
treef6e7192908f99fab62061913d8a1e9d2b918414b /actualbudget_to_schist_transformer/tests/run.rs
parentc7ed1e61ce2218be0b9e60577454124c4e43a366 (diff)
Tidier folders
Diffstat (limited to 'actualbudget_to_schist_transformer/tests/run.rs')
-rw-r--r--actualbudget_to_schist_transformer/tests/run.rs90
1 files changed, 0 insertions, 90 deletions
diff --git a/actualbudget_to_schist_transformer/tests/run.rs b/actualbudget_to_schist_transformer/tests/run.rs
deleted file mode 100644
index e882dc5..0000000
--- a/actualbudget_to_schist_transformer/tests/run.rs
+++ /dev/null
@@ -1,90 +0,0 @@
-pub mod common;
-
-use actualbudget_to_schist_transformer::run::run;
-use common::{assert_budget_drip_matches, get_account_matchers, get_account_transfer_matchers, get_category_matchers, get_category_transfer_matchers, get_num_expected_budget_drips, get_transaction_categorisation_matchers, get_transaction_matchers, TestContext, TEST_IN_DB_URL, TEST_OUT_DB_URL};
-use diesel::{Connection, SqliteConnection};
-use schist_queries::{account_transfers::get_all_account_transfers, accounts::get_all_accounts, budget_drips::get_all_budget_drips, categories::get_all_categories, category_transfers::get_all_category_transfers, transaction_categorisations::get_all_transaction_categorisations, transactions::get_all_transactions};
-
-#[test]
-fn given_test_database_when_run_then_exports_expected_schist_state() {
- let _context = TestContext::new();
- run(TEST_IN_DB_URL, TEST_OUT_DB_URL).unwrap();
- let connection = &mut SqliteConnection::establish(TEST_OUT_DB_URL).unwrap();
- let accounts = get_all_accounts(connection).unwrap();
- let account_transfers = get_all_account_transfers(connection).unwrap();
- let budget_drips = get_all_budget_drips(connection).unwrap();
- let categories = get_all_categories(connection).unwrap();
- let category_transfers = get_all_category_transfers(connection).unwrap();
- let transactions = get_all_transactions(connection).unwrap();
- let transaction_categorisations = get_all_transaction_categorisations(connection).unwrap();
-
- let account_matchers = get_account_matchers();
- assert_eq!(account_matchers.len(), accounts.len());
- for account in &accounts {
- assert!(
- account_matchers.iter().any(|m| m(&account)),
- "no match found for account {:?}",
- account,
- );
- }
-
- let account_transfer_matchers = get_account_transfer_matchers();
- assert_eq!(account_transfer_matchers.len(), account_transfers.len());
- for account_transfer in account_transfers {
- assert!(
- account_transfer_matchers.iter().any(|m| m(&account_transfer, &accounts)),
- "no match found for account_transfer {:?}",
- account_transfer,
- );
- }
-
- assert_eq!(get_num_expected_budget_drips(), budget_drips.len());
- for budget_drip in budget_drips {
- assert_budget_drip_matches(&budget_drip, &categories);
- }
-
- let category_matchers = get_category_matchers();
- assert_eq!(category_matchers.len(), categories.len());
- for category in categories.clone() {
- assert!(
- category_matchers.iter().any(|m| m(&category)),
- "no match found for category {:?}",
- category,
- );
- }
-
- let category_transfer_matchers = get_category_transfer_matchers();
- assert_eq!(category_transfer_matchers.len(), category_transfers.len());
- for category_transfer in category_transfers {
- assert!(
- category_transfer_matchers.iter().any(|m| m(&category_transfer, &categories)),
- "no match found for category_transfer {:?}",
- category_transfer,
- );
- }
-
- let transaction_matchers = get_transaction_matchers();
- assert_eq!(transaction_matchers.len(), transactions.len());
- for transaction in transactions.clone() {
- assert!(
- transaction_matchers.iter().any(|m| m(&transaction, &accounts)),
- "no match found for transaction {:?}",
- transaction,
- );
- }
-
- let transaction_categorisation_matchers = get_transaction_categorisation_matchers();
- assert_eq!(transaction_categorisation_matchers.len(), transaction_categorisations.len());
- for transaction_categorisation in transaction_categorisations {
- assert!(
- transaction_categorisation_matchers.iter().any(|m| m(
- &transaction_categorisation,
- &transactions,
- &categories,
- &accounts,
- )),
- "no match found for transaction_categorisation {:?}",
- transaction_categorisation,
- );
- }
-}