Notification parsing: - Drop the account_bindings table/DAO/repo/entity/controller/screen; account resolution now goes senderToAccount rule -> source_apps.defaultAccountId (trusted) -> global default (untrusted -> Inbox), via v1->v2 migration. - Add defaultAccountId to source_apps; per-app settings consolidated into source_app_detail_screen (/settings/parsing/apps/:pkg). - Inbox auto-learns an app default on first Confirm/CreateRule; account picker on the card instead of a disabled button; parse_error_labels extracted. Analytics: - Replace placeholder screen with fl_chart cards (chart_card, chart_theme, month_stepper, month_math domain helper); slim down habit_analysis_screen. Android: add launcher icon (adaptive foreground + colors.xml) and app_name. Tests: migration_v2, analytics (screen/month_math), AI retry, inbox visibility; update resolver/gate/inbox suites for the new resolution path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
36 lines
1.5 KiB
Dart
36 lines
1.5 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:new_budget/src/features/analytics/domain/month_math.dart';
|
|
|
|
void main() {
|
|
group('month_math', () {
|
|
test('monthStart / monthEnd — границы как в month_summary', () {
|
|
final m = DateTime(2026, 7, 15, 13, 45);
|
|
expect(monthStart(m), DateTime(2026, 7));
|
|
expect(monthEnd(m), DateTime(2026, 7, 31, 23, 59, 59, 999));
|
|
});
|
|
|
|
test('monthEnd — декабрь переходит в новый год', () {
|
|
expect(monthEnd(DateTime(2025, 12)), DateTime(2025, 12, 31, 23, 59, 59, 999));
|
|
});
|
|
|
|
test('previousMonth / addMonths — переходы через границу года', () {
|
|
expect(previousMonth(DateTime(2026, 1)), DateTime(2025, 12));
|
|
expect(addMonths(DateTime(2026, 11), 3), DateTime(2027, 2));
|
|
expect(addMonths(DateTime(2026, 2), -14), DateTime(2024, 12));
|
|
});
|
|
|
|
test('monthKeyOf ↔ monthFromKey — roundtrip, паддинг нулём', () {
|
|
expect(monthKeyOf(DateTime(2026, 3)), '2026-03');
|
|
expect(monthFromKey('2026-03'), DateTime(2026, 3));
|
|
expect(monthFromKey(monthKeyOf(DateTime(2024, 12))), DateTime(2024, 12));
|
|
});
|
|
|
|
test('daysInMonth — включая високосный февраль', () {
|
|
expect(daysInMonth(DateTime(2026, 2)), 28);
|
|
expect(daysInMonth(DateTime(2024, 2)), 29);
|
|
expect(daysInMonth(DateTime(2026, 7)), 31);
|
|
expect(daysInMonth(DateTime(2026, 6)), 30);
|
|
});
|
|
});
|
|
}
|