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);
@ -235,23 +238,24 @@ void main() {
final tx = Transaction( final tx = Transaction(
txid: "some txid", txid: "some txid",
confirmedStatus: false,
timestamp: 1648595998, timestamp: 1648595998,
txType: "Received", type: TransactionType.incoming,
amount: 100000000, amount: 100000000,
aliens: [], fee: 3794,
worthNow: "0.01", height: 450123,
worthAtBlockTimestamp: "0.01", subType: TransactionSubType.none,
fees: 3794, isCancelled: false,
inputSize: 1, walletId: '',
outputSize: 1, isLelantus: null,
inputs: [], slateId: '',
outputs: [], otherData: '')
address: "", ..address.value = Address(
height: 0, walletId: "walletId",
subType: "", value: "",
confirmations: 0, publicKey: [],
); 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);
@ -321,23 +325,24 @@ void main() {
final tx = Transaction( final tx = Transaction(
txid: "some txid", txid: "some txid",
confirmedStatus: false,
timestamp: 1648595998, timestamp: 1648595998,
txType: "Received", type: TransactionType.outgoing,
amount: 100000000, amount: 100000000,
aliens: [], fee: 3794,
worthNow: "0.01", height: 450123,
worthAtBlockTimestamp: "0.01", subType: TransactionSubType.none,
fees: 3794, isCancelled: false,
inputSize: 1, walletId: '',
outputSize: 1, isLelantus: null,
inputs: [], slateId: '',
outputs: [], otherData: '')
address: "", ..address.value = Address(
height: 250, walletId: "walletId",
subType: "", value: "",
confirmations: 10, publicKey: [],
); 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);