Add transfer tracking and secure admin access
This commit is contained in:
@@ -65,6 +65,32 @@ void main() {
|
||||
expect(ledger.transactionCount, 9);
|
||||
});
|
||||
|
||||
test('transfer DTO uses direction for effective income and expense', () {
|
||||
TxItem transfer(String direction) => TxItem.fromJson({
|
||||
'id': direction == 'in' ? 8 : 9,
|
||||
'ledgerId': 3,
|
||||
'categoryId': direction == 'in' ? 101 : 1,
|
||||
'categoryName': direction == 'in' ? '工资' : '餐饮',
|
||||
'categoryIcon': direction == 'in' ? 'money' : 'food',
|
||||
'type': 'transfer',
|
||||
'transferDirection': direction,
|
||||
'counterparty': '张三',
|
||||
'amount': 20,
|
||||
'source': 'accessibility',
|
||||
'occurredAt': '2026-07-25T03:00:00Z',
|
||||
});
|
||||
|
||||
final transferIn = transfer('in');
|
||||
final transferOut = transfer('out');
|
||||
expect(transferIn.isIncome, isTrue);
|
||||
expect(transferIn.isExpense, isFalse);
|
||||
expect(transferIn.typeLabel, '转入');
|
||||
expect(transferOut.isExpense, isTrue);
|
||||
expect(transferOut.isIncome, isFalse);
|
||||
expect(transferOut.typeLabel, '转出');
|
||||
expect(transferOut.counterparty, '张三');
|
||||
});
|
||||
|
||||
test('budget refinement DTO keeps conversation summary and constraints', () {
|
||||
final recommendation = BudgetRecommendations.fromJson({
|
||||
'year': 2026,
|
||||
|
||||
Reference in New Issue
Block a user