fix sync
This commit is contained in:
@@ -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']),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user