@@ -4,8 +4,11 @@ import 'package:flutter/widgets.dart';
44import 'package:flutter_test/flutter_test.dart' ;
55import 'package:zcash_wallet/src/core/theme/app_theme.dart' ;
66import 'package:zcash_wallet/src/core/widgets/app_icon.dart' ;
7+ import 'package:zcash_wallet/src/features/activity/activity_row_mapper.dart' ;
78import 'package:zcash_wallet/src/features/activity/models/activity_row_data.dart' ;
89import 'package:zcash_wallet/src/features/activity/widgets/activity_table.dart' ;
10+ import 'package:zcash_wallet/src/providers/sync_provider.dart' ;
11+ import 'package:zcash_wallet/src/rust/api/sync.dart' as rust_sync;
912
1013void main () {
1114 testWidgets ('transaction rows are keyboard activatable but sync row is not' , (
@@ -47,6 +50,74 @@ void main() {
4750 await tester.pump ();
4851 expect (txActivations, 2 );
4952 });
53+
54+ testWidgets ('activity rows render manipulated zatoshi values' , (
55+ tester,
56+ ) async {
57+ late final List <ActivityRowData > rows;
58+
59+ await tester.pumpWidget (
60+ MaterialApp (
61+ home: AppTheme (
62+ data: AppThemeData .light,
63+ child: Builder (
64+ builder: (context) {
65+ rows = buildActivityRows (
66+ context: context,
67+ sync : SyncState (totalBalance: BigInt .from (10000 )),
68+ transactions: [
69+ _tx (
70+ txidHex: 'received' ,
71+ kind: 'received' ,
72+ amount: BigInt .from (123450000 ),
73+ ),
74+ _tx (
75+ txidHex: 'sent' ,
76+ kind: 'sent' ,
77+ amount: BigInt .from (100000000 ),
78+ ),
79+ _tx (
80+ txidHex: 'shielded' ,
81+ kind: 'shielded' ,
82+ amount: BigInt .from (10000 ),
83+ ),
84+ ],
85+ );
86+ return ActivityTable (rows: rows);
87+ },
88+ ),
89+ ),
90+ ),
91+ );
92+
93+ expect (rows[0 ].amountText, '0.0001 ZEC' );
94+ expect (rows[1 ].amountText, '+1.23 ZEC' );
95+ expect (rows[2 ].amountText, '-1.00 ZEC' );
96+ expect (rows[3 ].amountText, '0.0001 ZEC' );
97+ expect (find.text ('0.0001 ZEC' ), findsNWidgets (2 ));
98+ expect (find.text ('+1.23 ZEC' ), findsOneWidget);
99+ expect (find.text ('-1.00 ZEC' ), findsOneWidget);
100+ });
101+ }
102+
103+ rust_sync.TransactionInfo _tx ({
104+ required String txidHex,
105+ required String kind,
106+ required BigInt amount,
107+ }) {
108+ return rust_sync.TransactionInfo (
109+ txidHex: txidHex,
110+ minedHeight: BigInt .one,
111+ expiredUnmined: false ,
112+ accountBalanceDelta: 0 ,
113+ fee: BigInt .zero,
114+ blockTime: BigInt .from (1800000000 ),
115+ isTransparent: false ,
116+ txKind: kind,
117+ displayAmount: amount,
118+ displayPool: 'shielded' ,
119+ createdTime: BigInt .from (1800000000 ),
120+ );
50121}
51122
52123ActivityRowData _row ({
0 commit comments