update transaction card test

This commit is contained in:
julian 2023-01-19 12:20:27 -06:00
parent e248a6fd77
commit e2b7c07b78

View file

@ -6,7 +6,8 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:mockingjay/mockingjay.dart' as mockingjay; import 'package:mockingjay/mockingjay.dart' as mockingjay;
import 'package:mockito/annotations.dart'; import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart'; import 'package:mockito/mockito.dart';
import 'package:stackwallet/models/models.dart'; import 'package:stackwallet/models/isar/models/address/address.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/transaction.dart';
import 'package:stackwallet/pages/wallet_view/transaction_views/transaction_details_view.dart'; import 'package:stackwallet/pages/wallet_view/transaction_views/transaction_details_view.dart';
import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/services/coins/coin_service.dart'; import 'package:stackwallet/services/coins/coin_service.dart';
@ -47,23 +48,24 @@ void main() {
final tx = Transaction( final tx = Transaction(
txid: "some txid", txid: "some txid",
confirmedStatus: true,
timestamp: 1648595998, timestamp: 1648595998,
txType: "Sent", type: TransactionType.outgoing,
amount: 100000000, amount: 100000000,
aliens: [], fee: 3794,
worthNow: "0.01",
worthAtBlockTimestamp: "0.01",
fees: 3794,
inputSize: 1,
outputSize: 1,
inputs: [],
outputs: [],
address: "",
height: 450123, height: 450123,
subType: "", subType: TransactionSubType.none,
confirmations: 10, isCancelled: false,
isCancelled: false); walletId: '',
isLelantus: null,
slateId: '',
otherData: '')
..address.value = Address(
walletId: "walletId",
value: "",
publicKey: [],
derivationIndex: 0,
type: AddressType.p2pkh,
subType: AddressSubType.receiving);
final CoinServiceAPI wallet = MockFiroWallet(); final CoinServiceAPI wallet = MockFiroWallet();
@ -125,7 +127,7 @@ void main() {
verify(mockPrefs.currency).called(1); verify(mockPrefs.currency).called(1);
verify(mockPriceService.getPrice(Coin.firo)).called(1); verify(mockPriceService.getPrice(Coin.firo)).called(1);
verify(wallet.coin.ticker).called(1); verify(wallet.coin.ticker).called(2);
verify(mockLocaleService.locale).called(1); verify(mockLocaleService.locale).called(1);
@ -142,23 +144,24 @@ void main() {
final tx = Transaction( final tx = Transaction(
txid: "some txid", txid: "some txid",
confirmedStatus: true,
timestamp: 1648595998, timestamp: 1648595998,
txType: "Anonymized", type: TransactionType.outgoing,
amount: 100000000, amount: 9659,
aliens: [], fee: 3794,
worthNow: "0.01",
worthAtBlockTimestamp: "0.01",
fees: 3794,
inputSize: 1,
outputSize: 1,
inputs: [],
outputs: [],
address: "",
height: 450123, height: 450123,
subType: "mint", subType: TransactionSubType.mint,
confirmations: 10, isCancelled: false,
isCancelled: false); walletId: '',
isLelantus: null,
slateId: '',
otherData: '')
..address.value = Address(
walletId: "walletId",
value: "",
publicKey: [],
derivationIndex: 0,
type: AddressType.p2pkh,
subType: AddressSubType.receiving);
final CoinServiceAPI wallet = MockFiroWallet(); final CoinServiceAPI wallet = MockFiroWallet();
@ -199,7 +202,7 @@ void main() {
// //
final title = find.text("Anonymized"); final title = find.text("Anonymized");
// final price1 = find.text("0.00 USD"); // final price1 = find.text("0.00 USD");
final amount = find.text("1.00000000 FIRO"); final amount = find.text("-0.00009659 FIRO");
final icon = find.byIcon(FeatherIcons.arrowUp); final icon = find.byIcon(FeatherIcons.arrowUp);
@ -218,7 +221,7 @@ void main() {
verify(mockPrefs.currency).called(1); verify(mockPrefs.currency).called(1);
verify(mockPriceService.getPrice(Coin.firo)).called(1); verify(mockPriceService.getPrice(Coin.firo)).called(1);
verify(wallet.coin.ticker).called(1); verify(wallet.coin.ticker).called(2);
verify(mockLocaleService.locale).called(1); verify(mockLocaleService.locale).called(1);
@ -234,24 +237,25 @@ void main() {
final mockPriceService = MockPriceService(); final mockPriceService = MockPriceService();
final tx = Transaction( final tx = Transaction(
txid: "some txid", txid: "some txid",
confirmedStatus: false, timestamp: 1648595998,
timestamp: 1648595998, type: TransactionType.incoming,
txType: "Received", amount: 100000000,
amount: 100000000, fee: 3794,
aliens: [], height: 450123,
worthNow: "0.01", subType: TransactionSubType.none,
worthAtBlockTimestamp: "0.01", isCancelled: false,
fees: 3794, walletId: '',
inputSize: 1, isLelantus: null,
outputSize: 1, slateId: '',
inputs: [], otherData: '')
outputs: [], ..address.value = Address(
address: "", walletId: "walletId",
height: 0, value: "",
subType: "", publicKey: [],
confirmations: 0, derivationIndex: 0,
); type: AddressType.p2pkh,
subType: AddressSubType.receiving);
final CoinServiceAPI wallet = MockFiroWallet(); final CoinServiceAPI wallet = MockFiroWallet();
@ -289,7 +293,7 @@ void main() {
), ),
); );
final title = find.text("Receiving"); final title = find.text("Received");
final amount = Util.isDesktop final amount = Util.isDesktop
? find.text("+1.00000000 FIRO") ? find.text("+1.00000000 FIRO")
: find.text("1.00000000 FIRO"); : find.text("1.00000000 FIRO");
@ -303,7 +307,7 @@ void main() {
verify(mockPrefs.currency).called(1); verify(mockPrefs.currency).called(1);
verify(mockPriceService.getPrice(Coin.firo)).called(1); verify(mockPriceService.getPrice(Coin.firo)).called(1);
verify(wallet.coin.ticker).called(1); verify(wallet.coin.ticker).called(2);
verify(mockLocaleService.locale).called(1); verify(mockLocaleService.locale).called(1);
@ -320,24 +324,25 @@ void main() {
final navigator = mockingjay.MockNavigator(); final navigator = mockingjay.MockNavigator();
final tx = Transaction( final tx = Transaction(
txid: "some txid", txid: "some txid",
confirmedStatus: false, timestamp: 1648595998,
timestamp: 1648595998, type: TransactionType.outgoing,
txType: "Received", amount: 100000000,
amount: 100000000, fee: 3794,
aliens: [], height: 450123,
worthNow: "0.01", subType: TransactionSubType.none,
worthAtBlockTimestamp: "0.01", isCancelled: false,
fees: 3794, walletId: '',
inputSize: 1, isLelantus: null,
outputSize: 1, slateId: '',
inputs: [], otherData: '')
outputs: [], ..address.value = Address(
address: "", walletId: "walletId",
height: 250, value: "",
subType: "", publicKey: [],
confirmations: 10, derivationIndex: 0,
); type: AddressType.p2pkh,
subType: AddressSubType.receiving);
final CoinServiceAPI wallet = MockFiroWallet(); final CoinServiceAPI wallet = MockFiroWallet();
@ -389,7 +394,7 @@ void main() {
verify(mockPrefs.currency).called(2); verify(mockPrefs.currency).called(2);
verify(mockLocaleService.locale).called(4); verify(mockLocaleService.locale).called(4);
verify(wallet.coin.ticker).called(1); verify(wallet.coin.ticker).called(2);
verifyNoMoreInteractions(wallet); verifyNoMoreInteractions(wallet);
verifyNoMoreInteractions(mockLocaleService); verifyNoMoreInteractions(mockLocaleService);