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:mockito/annotations.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/providers/providers.dart';
import 'package:stackwallet/services/coins/coin_service.dart';
@ -47,23 +48,24 @@ void main() {
final tx = Transaction(
txid: "some txid",
confirmedStatus: true,
timestamp: 1648595998,
txType: "Sent",
type: TransactionType.outgoing,
amount: 100000000,
aliens: [],
worthNow: "0.01",
worthAtBlockTimestamp: "0.01",
fees: 3794,
inputSize: 1,
outputSize: 1,
inputs: [],
outputs: [],
address: "",
fee: 3794,
height: 450123,
subType: "",
confirmations: 10,
isCancelled: false);
subType: TransactionSubType.none,
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();
@ -125,7 +127,7 @@ void main() {
verify(mockPrefs.currency).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);
@ -142,23 +144,24 @@ void main() {
final tx = Transaction(
txid: "some txid",
confirmedStatus: true,
timestamp: 1648595998,
txType: "Anonymized",
amount: 100000000,
aliens: [],
worthNow: "0.01",
worthAtBlockTimestamp: "0.01",
fees: 3794,
inputSize: 1,
outputSize: 1,
inputs: [],
outputs: [],
address: "",
type: TransactionType.outgoing,
amount: 9659,
fee: 3794,
height: 450123,
subType: "mint",
confirmations: 10,
isCancelled: false);
subType: TransactionSubType.mint,
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();
@ -199,7 +202,7 @@ void main() {
//
final title = find.text("Anonymized");
// 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);
@ -218,7 +221,7 @@ void main() {
verify(mockPrefs.currency).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);
@ -235,23 +238,24 @@ void main() {
final tx = Transaction(
txid: "some txid",
confirmedStatus: false,
timestamp: 1648595998,
txType: "Received",
type: TransactionType.incoming,
amount: 100000000,
aliens: [],
worthNow: "0.01",
worthAtBlockTimestamp: "0.01",
fees: 3794,
inputSize: 1,
outputSize: 1,
inputs: [],
outputs: [],
address: "",
height: 0,
subType: "",
confirmations: 0,
);
fee: 3794,
height: 450123,
subType: TransactionSubType.none,
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();
@ -289,7 +293,7 @@ void main() {
),
);
final title = find.text("Receiving");
final title = find.text("Received");
final amount = Util.isDesktop
? find.text("+1.00000000 FIRO")
: find.text("1.00000000 FIRO");
@ -303,7 +307,7 @@ void main() {
verify(mockPrefs.currency).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);
@ -321,23 +325,24 @@ void main() {
final tx = Transaction(
txid: "some txid",
confirmedStatus: false,
timestamp: 1648595998,
txType: "Received",
type: TransactionType.outgoing,
amount: 100000000,
aliens: [],
worthNow: "0.01",
worthAtBlockTimestamp: "0.01",
fees: 3794,
inputSize: 1,
outputSize: 1,
inputs: [],
outputs: [],
address: "",
height: 250,
subType: "",
confirmations: 10,
);
fee: 3794,
height: 450123,
subType: TransactionSubType.none,
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();
@ -389,7 +394,7 @@ void main() {
verify(mockPrefs.currency).called(2);
verify(mockLocaleService.locale).called(4);
verify(wallet.coin.ticker).called(1);
verify(wallet.coin.ticker).called(2);
verifyNoMoreInteractions(wallet);
verifyNoMoreInteractions(mockLocaleService);