This commit is contained in:
davmar
2026-09-10 11:40:28 +02:00
parent 68623b38ff
commit aec89ac41d
5 changed files with 127 additions and 7 deletions
+36
View File
@@ -97,4 +97,40 @@ void main() {
]));
expect(merged.first.date, '2024-01-03');
});
test('bank API merge keeps cloud-only txs outside the API window', () {
const cloudOnly = BankTransaction(
date: '2020-06-01',
description: 'Old cloud tx',
amount: -20,
currency: 'EUR',
pending: false,
);
const recentShared = BankTransaction(
date: '2026-09-01',
description: 'Recent Shop',
amount: -5,
currency: 'EUR',
pending: false,
);
const apiOnly = BankTransaction(
date: '2026-09-02',
description: 'New API tx',
amount: -3,
currency: 'EUR',
pending: false,
);
// Same order as BankController._loadLinkedData: API first, then existing.
final afterRefresh = mergeBankTransactionLists(
[recentShared, apiOnly],
[cloudOnly, recentShared],
);
expect(afterRefresh.length, 3);
expect(
afterRefresh.map((t) => t.description),
containsAll(['Old cloud tx', 'Recent Shop', 'New API tx']),
);
});
}