nice overview working
This commit is contained in:
+51
-1
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:myapp/main.dart';
|
||||
import 'package:myapp/models/bank.dart';
|
||||
@@ -51,13 +52,62 @@ void main() {
|
||||
'pending': false,
|
||||
});
|
||||
expect(tx.descriptionKey, contains('pasvolgnr'));
|
||||
expect(tx.merchantKey, contains('ah campus diemen'));
|
||||
expect(tx.merchantKey, 'ah campus');
|
||||
expect(tx.merchantKey.contains('pasvolgnr'), isFalse);
|
||||
expect(tx.exactKey, contains('-3.5'));
|
||||
expect(formatMoney(tx.amount, tx.currency), contains('EUR'));
|
||||
expect(kBuiltinLabels.first.name, 'Groceries');
|
||||
});
|
||||
|
||||
test('merchant stems group Albert Heijn / AH across stores', () {
|
||||
final a = merchantKeyFromDescription('Albert Heijn 1562 Utrecht NLD');
|
||||
final b = merchantKeyFromDescription('ALBERT HEIJN 1847 AMSTERDAM');
|
||||
final c = merchantKeyFromDescription(
|
||||
'BCK*AH CAMPUS DIEMEN ZUID NLD Pasvolgnr: 001 Transactie: X',
|
||||
);
|
||||
final d = merchantKeyFromDescription('AH CAMPUS AMSTERDAM NLD');
|
||||
expect(a, 'albert heijn');
|
||||
expect(b, 'albert heijn');
|
||||
expect(c, 'ah campus');
|
||||
expect(d, 'ah campus');
|
||||
expect(descriptionMatchesPattern('Albert Heijn 1562 Utrecht', a), isTrue);
|
||||
expect(
|
||||
descriptionMatchesPattern('Jumbo City Centrum', a),
|
||||
isFalse,
|
||||
);
|
||||
expect(
|
||||
descriptionMatchesPattern('AH CAMPUS DIEMEN', '/ah campus/'),
|
||||
isTrue,
|
||||
);
|
||||
});
|
||||
|
||||
test('flattenLabelTree indents children under parents', () {
|
||||
const parent = TxLabel(
|
||||
id: 'groceries',
|
||||
name: 'Groceries',
|
||||
color: Color(0xFF16A34A),
|
||||
);
|
||||
const child = TxLabel(
|
||||
id: 'custom_ah',
|
||||
name: 'Albert Heijn',
|
||||
color: Color(0xFF0F766E),
|
||||
custom: true,
|
||||
parentId: 'groceries',
|
||||
);
|
||||
const other = TxLabel(
|
||||
id: 'dining',
|
||||
name: 'Dining',
|
||||
color: Color(0xFFEA580C),
|
||||
);
|
||||
final tree = flattenLabelTree([child, other, parent]);
|
||||
expect(tree.map((e) => e.label.id).toList(), [
|
||||
'dining',
|
||||
'groceries',
|
||||
'custom_ah',
|
||||
]);
|
||||
expect(tree.map((e) => e.depth).toList(), [0, 0, 1]);
|
||||
});
|
||||
|
||||
test('look-ahead applies monthly recurring amounts', () {
|
||||
final items = [
|
||||
const RecurringItem(
|
||||
|
||||
Reference in New Issue
Block a user