diff --git a/test/widget_tests/transaction_card_test.dart b/test/widget_tests/transaction_card_test.dart index f28c5f81d..0ab7e4477 100644 --- a/test/widget_tests/transaction_card_test.dart +++ b/test/widget_tests/transaction_card_test.dart @@ -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); @@ -234,24 +237,25 @@ void main() { final mockPriceService = MockPriceService(); final tx = Transaction( - txid: "some txid", - confirmedStatus: false, - timestamp: 1648595998, - txType: "Received", - amount: 100000000, - aliens: [], - worthNow: "0.01", - worthAtBlockTimestamp: "0.01", - fees: 3794, - inputSize: 1, - outputSize: 1, - inputs: [], - outputs: [], - address: "", - height: 0, - subType: "", - confirmations: 0, - ); + txid: "some txid", + timestamp: 1648595998, + type: TransactionType.incoming, + amount: 100000000, + 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); @@ -320,24 +324,25 @@ void main() { final navigator = mockingjay.MockNavigator(); final tx = Transaction( - txid: "some txid", - confirmedStatus: false, - timestamp: 1648595998, - txType: "Received", - amount: 100000000, - aliens: [], - worthNow: "0.01", - worthAtBlockTimestamp: "0.01", - fees: 3794, - inputSize: 1, - outputSize: 1, - inputs: [], - outputs: [], - address: "", - height: 250, - subType: "", - confirmations: 10, - ); + txid: "some txid", + timestamp: 1648595998, + type: TransactionType.outgoing, + amount: 100000000, + 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);