Riverpod + go_router с auth-guard, NavigationRail на широком экране и bottom bar на узком. Токены в flutter_secure_storage, на web access живёт в памяти. Интерцептор подставляет токен и делает ровно один refresh на 401. Деньги приходят строками и форматируются через Decimal: парсить их в double значило бы терять копейки ровно там, где бэкенд их бережёт.
52 lines
1.4 KiB
Dart
52 lines
1.4 KiB
Dart
import 'package:fintracker_api/fintracker_api.dart';
|
|
import 'package:fintracker_app/core/widgets/money_text.dart';
|
|
import 'package:fintracker_app/features/transactions/transaction_row.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
TransactionOut _usdExpense() => TransactionOut(
|
|
categoryId: 1,
|
|
comment: null,
|
|
date: DateTime(2026, 9, 10),
|
|
deleted: false,
|
|
flowType: FlowType.expense,
|
|
hold: false,
|
|
id: 1,
|
|
income: '0',
|
|
incomeAccountId: null,
|
|
incomeCurrency: null,
|
|
incomeRub: null,
|
|
isOneOff: false,
|
|
mcc: null,
|
|
outcome: '100',
|
|
outcomeAccountId: 7,
|
|
outcomeCurrency: 'USD',
|
|
outcomeRub: '9500.00',
|
|
payee: 'Amazon.com',
|
|
payeeCanonical: 'Amazon',
|
|
sourceId: 'src-1',
|
|
tags: const [],
|
|
tripId: null,
|
|
ts: DateTime(2026, 9, 10),
|
|
);
|
|
|
|
void main() {
|
|
testWidgets('shows a USD amount with its RUB equivalent as secondary text', (tester) async {
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
home: Scaffold(
|
|
body: TransactionRow(
|
|
transaction: _usdExpense(),
|
|
categoryName: 'Покупки',
|
|
onTap: () {},
|
|
),
|
|
),
|
|
),
|
|
);
|
|
|
|
expect(find.text('Amazon'), findsOneWidget);
|
|
expect(find.text(MoneyText.format('100', 'USD')), findsOneWidget);
|
|
expect(find.text(MoneyText.format('9500.00', 'RUB')), findsOneWidget);
|
|
});
|
|
}
|