mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-22 19:39:22 +00:00
fix tests
This commit is contained in:
parent
2e72a846a9
commit
347c69339c
11 changed files with 49 additions and 157 deletions
|
@ -9,6 +9,7 @@ import 'package:stackwallet/electrumx_rpc/electrumx.dart';
|
||||||
import 'package:stackwallet/models/paymint/fee_object_model.dart';
|
import 'package:stackwallet/models/paymint/fee_object_model.dart';
|
||||||
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
|
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
|
||||||
import 'package:stackwallet/services/transaction_notification_tracker.dart';
|
import 'package:stackwallet/services/transaction_notification_tracker.dart';
|
||||||
|
import 'package:stackwallet/utilities/amount/amount.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
|
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
|
||||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
||||||
|
@ -27,7 +28,13 @@ void main() async {
|
||||||
expect(MINIMUM_CONFIRMATIONS, 1);
|
expect(MINIMUM_CONFIRMATIONS, 1);
|
||||||
});
|
});
|
||||||
test("bitcoin dust limit", () async {
|
test("bitcoin dust limit", () async {
|
||||||
expect(DUST_LIMIT, 294);
|
expect(
|
||||||
|
DUST_LIMIT,
|
||||||
|
Amount(
|
||||||
|
rawValue: BigInt.from(294),
|
||||||
|
fractionDigits: 8,
|
||||||
|
),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
test("bitcoin mainnet genesis block hash", () async {
|
test("bitcoin mainnet genesis block hash", () async {
|
||||||
expect(GENESIS_HASH_MAINNET,
|
expect(GENESIS_HASH_MAINNET,
|
||||||
|
|
|
@ -10,6 +10,7 @@ import 'package:stackwallet/electrumx_rpc/electrumx.dart';
|
||||||
import 'package:stackwallet/models/paymint/fee_object_model.dart';
|
import 'package:stackwallet/models/paymint/fee_object_model.dart';
|
||||||
import 'package:stackwallet/services/coins/bitcoincash/bitcoincash_wallet.dart';
|
import 'package:stackwallet/services/coins/bitcoincash/bitcoincash_wallet.dart';
|
||||||
import 'package:stackwallet/services/transaction_notification_tracker.dart';
|
import 'package:stackwallet/services/transaction_notification_tracker.dart';
|
||||||
|
import 'package:stackwallet/utilities/amount/amount.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
|
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
|
||||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
||||||
|
@ -28,7 +29,13 @@ void main() async {
|
||||||
expect(MINIMUM_CONFIRMATIONS, 0);
|
expect(MINIMUM_CONFIRMATIONS, 0);
|
||||||
});
|
});
|
||||||
test("bitcoincash dust limit", () async {
|
test("bitcoincash dust limit", () async {
|
||||||
expect(DUST_LIMIT, 546);
|
expect(
|
||||||
|
DUST_LIMIT,
|
||||||
|
Amount(
|
||||||
|
rawValue: BigInt.from(546),
|
||||||
|
fractionDigits: 8,
|
||||||
|
),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
test("bitcoincash mainnet genesis block hash", () async {
|
test("bitcoincash mainnet genesis block hash", () async {
|
||||||
expect(GENESIS_HASH_MAINNET,
|
expect(GENESIS_HASH_MAINNET,
|
||||||
|
@ -520,37 +527,6 @@ void main() async {
|
||||||
verifyNoMoreInteractions(cachedClient);
|
verifyNoMoreInteractions(cachedClient);
|
||||||
verifyNoMoreInteractions(tracker);
|
verifyNoMoreInteractions(tracker);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("get maxFee", () async {
|
|
||||||
when(client?.ping()).thenAnswer((_) async => true);
|
|
||||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
|
||||||
"hosts": <dynamic, dynamic>{},
|
|
||||||
"pruning": null,
|
|
||||||
"server_version": "Unit tests",
|
|
||||||
"protocol_min": "1.4",
|
|
||||||
"protocol_max": "1.4.2",
|
|
||||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
|
||||||
"hash_function": "sha256",
|
|
||||||
"services": <dynamic>[]
|
|
||||||
});
|
|
||||||
when(client?.estimateFee(blocks: 20))
|
|
||||||
.thenAnswer((realInvocation) async => Decimal.zero);
|
|
||||||
when(client?.estimateFee(blocks: 5))
|
|
||||||
.thenAnswer((realInvocation) async => Decimal.one);
|
|
||||||
when(client?.estimateFee(blocks: 1))
|
|
||||||
.thenAnswer((realInvocation) async => Decimal.ten);
|
|
||||||
|
|
||||||
final maxFee = await bch?.maxFee;
|
|
||||||
expect(maxFee, 1000000000);
|
|
||||||
|
|
||||||
verify(client?.estimateFee(blocks: 1)).called(1);
|
|
||||||
verify(client?.estimateFee(blocks: 5)).called(1);
|
|
||||||
verify(client?.estimateFee(blocks: 20)).called(1);
|
|
||||||
expect(secureStore.interactions, 0);
|
|
||||||
verifyNoMoreInteractions(client);
|
|
||||||
verifyNoMoreInteractions(cachedClient);
|
|
||||||
verifyNoMoreInteractions(tracker);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
group("BCHWallet service class functions that depend on shared storage", () {
|
group("BCHWallet service class functions that depend on shared storage", () {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import 'package:stackwallet/electrumx_rpc/electrumx.dart';
|
||||||
import 'package:stackwallet/models/paymint/fee_object_model.dart';
|
import 'package:stackwallet/models/paymint/fee_object_model.dart';
|
||||||
import 'package:stackwallet/services/coins/dogecoin/dogecoin_wallet.dart';
|
import 'package:stackwallet/services/coins/dogecoin/dogecoin_wallet.dart';
|
||||||
import 'package:stackwallet/services/transaction_notification_tracker.dart';
|
import 'package:stackwallet/services/transaction_notification_tracker.dart';
|
||||||
|
import 'package:stackwallet/utilities/amount/amount.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
|
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
|
||||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
||||||
|
@ -28,7 +29,13 @@ void main() {
|
||||||
expect(MINIMUM_CONFIRMATIONS, 1);
|
expect(MINIMUM_CONFIRMATIONS, 1);
|
||||||
});
|
});
|
||||||
test("dogecoin dust limit", () async {
|
test("dogecoin dust limit", () async {
|
||||||
expect(DUST_LIMIT, 1000000);
|
expect(
|
||||||
|
DUST_LIMIT,
|
||||||
|
Amount(
|
||||||
|
rawValue: BigInt.from(1000000),
|
||||||
|
fractionDigits: 8,
|
||||||
|
),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
test("dogecoin mainnet genesis block hash", () async {
|
test("dogecoin mainnet genesis block hash", () async {
|
||||||
expect(GENESIS_HASH_MAINNET,
|
expect(GENESIS_HASH_MAINNET,
|
||||||
|
@ -366,37 +373,6 @@ void main() {
|
||||||
verifyNoMoreInteractions(cachedClient);
|
verifyNoMoreInteractions(cachedClient);
|
||||||
verifyNoMoreInteractions(tracker);
|
verifyNoMoreInteractions(tracker);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("get maxFee", () async {
|
|
||||||
when(client?.ping()).thenAnswer((_) async => true);
|
|
||||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
|
||||||
"hosts": <dynamic, dynamic>{},
|
|
||||||
"pruning": null,
|
|
||||||
"server_version": "Unit tests",
|
|
||||||
"protocol_min": "1.4",
|
|
||||||
"protocol_max": "1.4.2",
|
|
||||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
|
||||||
"hash_function": "sha256",
|
|
||||||
"services": <dynamic>[]
|
|
||||||
});
|
|
||||||
when(client?.estimateFee(blocks: 20))
|
|
||||||
.thenAnswer((realInvocation) async => Decimal.zero);
|
|
||||||
when(client?.estimateFee(blocks: 5))
|
|
||||||
.thenAnswer((realInvocation) async => Decimal.one);
|
|
||||||
when(client?.estimateFee(blocks: 1))
|
|
||||||
.thenAnswer((realInvocation) async => Decimal.ten);
|
|
||||||
|
|
||||||
final maxFee = await doge?.maxFee;
|
|
||||||
expect(maxFee, 1000000000);
|
|
||||||
|
|
||||||
verify(client?.estimateFee(blocks: 1)).called(1);
|
|
||||||
verify(client?.estimateFee(blocks: 5)).called(1);
|
|
||||||
verify(client?.estimateFee(blocks: 20)).called(1);
|
|
||||||
expect(secureStore.interactions, 0);
|
|
||||||
verifyNoMoreInteractions(client);
|
|
||||||
verifyNoMoreInteractions(cachedClient);
|
|
||||||
verifyNoMoreInteractions(tracker);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
group("DogeWallet service class functions that depend on shared storage", () {
|
group("DogeWallet service class functions that depend on shared storage", () {
|
||||||
|
|
|
@ -83,24 +83,21 @@ void main() {
|
||||||
group("get balances", () {
|
group("get balances", () {
|
||||||
test("balance", () async {
|
test("balance", () async {
|
||||||
final CoinServiceAPI wallet = MockFiroWallet();
|
final CoinServiceAPI wallet = MockFiroWallet();
|
||||||
|
final balance = Balance(
|
||||||
|
total: _a(10),
|
||||||
|
spendable: _a(1),
|
||||||
|
blockedTotal: _a(0),
|
||||||
|
pendingSpendable: _a(9),
|
||||||
|
);
|
||||||
|
|
||||||
when(wallet.coin).thenAnswer((_) => Coin.firo);
|
when(wallet.coin).thenAnswer((_) => Coin.firo);
|
||||||
when(wallet.balance).thenAnswer(
|
when(wallet.balance).thenAnswer(
|
||||||
(_) => Balance(
|
(_) => balance,
|
||||||
coin: Coin.firo,
|
|
||||||
total: _a(10),
|
|
||||||
spendable: _a(1),
|
|
||||||
blockedTotal: _a(0),
|
|
||||||
pendingSpendable: _a(9),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
final manager = Manager(wallet);
|
final manager = Manager(wallet);
|
||||||
|
|
||||||
expect(manager.balance.coin, Coin.firo);
|
expect(manager.balance, balance);
|
||||||
expect(manager.balance.total.raw.toInt(), 10);
|
|
||||||
expect(manager.balance.spendable.raw.toInt(), 1);
|
|
||||||
expect(manager.balance.blockedTotal.raw.toInt(), 0);
|
|
||||||
expect(manager.balance.pendingSpendable.raw.toInt(), 9);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import 'package:stackwallet/electrumx_rpc/electrumx.dart';
|
||||||
import 'package:stackwallet/models/paymint/fee_object_model.dart';
|
import 'package:stackwallet/models/paymint/fee_object_model.dart';
|
||||||
import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart';
|
import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart';
|
||||||
import 'package:stackwallet/services/transaction_notification_tracker.dart';
|
import 'package:stackwallet/services/transaction_notification_tracker.dart';
|
||||||
|
import 'package:stackwallet/utilities/amount/amount.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
|
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
|
||||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
||||||
|
@ -27,7 +28,13 @@ void main() {
|
||||||
expect(MINIMUM_CONFIRMATIONS, 2);
|
expect(MINIMUM_CONFIRMATIONS, 2);
|
||||||
});
|
});
|
||||||
test("namecoin dust limit", () async {
|
test("namecoin dust limit", () async {
|
||||||
expect(DUST_LIMIT, 546);
|
expect(
|
||||||
|
DUST_LIMIT,
|
||||||
|
Amount(
|
||||||
|
rawValue: BigInt.from(546),
|
||||||
|
fractionDigits: 8,
|
||||||
|
),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
test("namecoin mainnet genesis block hash", () async {
|
test("namecoin mainnet genesis block hash", () async {
|
||||||
expect(GENESIS_HASH_MAINNET,
|
expect(GENESIS_HASH_MAINNET,
|
||||||
|
|
|
@ -9,6 +9,7 @@ import 'package:stackwallet/electrumx_rpc/electrumx.dart';
|
||||||
import 'package:stackwallet/models/paymint/fee_object_model.dart';
|
import 'package:stackwallet/models/paymint/fee_object_model.dart';
|
||||||
import 'package:stackwallet/services/coins/particl/particl_wallet.dart';
|
import 'package:stackwallet/services/coins/particl/particl_wallet.dart';
|
||||||
import 'package:stackwallet/services/transaction_notification_tracker.dart';
|
import 'package:stackwallet/services/transaction_notification_tracker.dart';
|
||||||
|
import 'package:stackwallet/utilities/amount/amount.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
|
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
|
||||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
||||||
|
@ -28,7 +29,13 @@ void main() {
|
||||||
1); // TODO confirm particl minimum confirmations
|
1); // TODO confirm particl minimum confirmations
|
||||||
});
|
});
|
||||||
test("particl dust limit", () async {
|
test("particl dust limit", () async {
|
||||||
expect(DUST_LIMIT, 294); // TODO confirm particl dust limit
|
expect(
|
||||||
|
DUST_LIMIT,
|
||||||
|
Amount(
|
||||||
|
rawValue: BigInt.from(294),
|
||||||
|
fractionDigits: 8,
|
||||||
|
),
|
||||||
|
); // TODO confirm particl dust limit
|
||||||
});
|
});
|
||||||
test("particl mainnet genesis block hash", () async {
|
test("particl mainnet genesis block hash", () async {
|
||||||
expect(GENESIS_HASH_MAINNET,
|
expect(GENESIS_HASH_MAINNET,
|
||||||
|
|
|
@ -53,7 +53,6 @@ void main() {
|
||||||
.thenAnswer((realInvocation) => manager);
|
.thenAnswer((realInvocation) => manager);
|
||||||
when(manager.balance).thenAnswer(
|
when(manager.balance).thenAnswer(
|
||||||
(realInvocation) => Balance(
|
(realInvocation) => Balance(
|
||||||
coin: Coin.bitcoin,
|
|
||||||
total: _a(10),
|
total: _a(10),
|
||||||
spendable: _a(10),
|
spendable: _a(10),
|
||||||
blockedTotal: _a(0),
|
blockedTotal: _a(0),
|
||||||
|
@ -106,7 +105,6 @@ void main() {
|
||||||
.thenAnswer((realInvocation) => manager);
|
.thenAnswer((realInvocation) => manager);
|
||||||
when(manager.balance).thenAnswer(
|
when(manager.balance).thenAnswer(
|
||||||
(realInvocation) => Balance(
|
(realInvocation) => Balance(
|
||||||
coin: Coin.bitcoin,
|
|
||||||
total: _a(10),
|
total: _a(10),
|
||||||
spendable: _a(10),
|
spendable: _a(10),
|
||||||
blockedTotal: _a(0),
|
blockedTotal: _a(0),
|
||||||
|
@ -177,7 +175,6 @@ void main() {
|
||||||
when(manager.isFavorite).thenAnswer((realInvocation) => true);
|
when(manager.isFavorite).thenAnswer((realInvocation) => true);
|
||||||
when(manager.balance).thenAnswer(
|
when(manager.balance).thenAnswer(
|
||||||
(realInvocation) => Balance(
|
(realInvocation) => Balance(
|
||||||
coin: Coin.bitcoin,
|
|
||||||
total: _a(10),
|
total: _a(10),
|
||||||
spendable: _a(10),
|
spendable: _a(10),
|
||||||
blockedTotal: _a(0),
|
blockedTotal: _a(0),
|
||||||
|
|
|
@ -40,7 +40,6 @@ void main() {
|
||||||
when(wallet.walletId).thenAnswer((_) => "Wallet id 1");
|
when(wallet.walletId).thenAnswer((_) => "Wallet id 1");
|
||||||
when(wallet.balance).thenAnswer(
|
when(wallet.balance).thenAnswer(
|
||||||
(_) => Balance(
|
(_) => Balance(
|
||||||
coin: Coin.bitcoin,
|
|
||||||
total: Amount.zero,
|
total: Amount.zero,
|
||||||
spendable: Amount.zero,
|
spendable: Amount.zero,
|
||||||
blockedTotal: Amount.zero,
|
blockedTotal: Amount.zero,
|
||||||
|
|
|
@ -2,7 +2,6 @@ import 'package:decimal/decimal.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:mockingjay/mockingjay.dart' as mockingjay;
|
|
||||||
import 'package:mockito/annotations.dart';
|
import 'package:mockito/annotations.dart';
|
||||||
import 'package:mockito/mockito.dart' as mockito;
|
import 'package:mockito/mockito.dart' as mockito;
|
||||||
import 'package:stackwallet/models/balance.dart';
|
import 'package:stackwallet/models/balance.dart';
|
||||||
|
@ -17,7 +16,6 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/theme/light_colors.dart';
|
import 'package:stackwallet/utilities/theme/light_colors.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
import 'package:stackwallet/widgets/wallet_card.dart';
|
import 'package:stackwallet/widgets/wallet_card.dart';
|
||||||
import 'package:tuple/tuple.dart';
|
|
||||||
|
|
||||||
import 'wallet_card_test.mocks.dart';
|
import 'wallet_card_test.mocks.dart';
|
||||||
|
|
||||||
|
@ -30,75 +28,6 @@ Amount _a(int i) => Amount.fromDecimal(
|
||||||
|
|
||||||
@GenerateMocks([Wallets, BitcoinWallet, LocaleService])
|
@GenerateMocks([Wallets, BitcoinWallet, LocaleService])
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets("Test button pressed", (widgetTester) async {
|
|
||||||
final CoinServiceAPI wallet = MockBitcoinWallet();
|
|
||||||
mockito.when(wallet.walletId).thenAnswer((realInvocation) => "wallet id");
|
|
||||||
mockito.when(wallet.coin).thenAnswer((realInvocation) => Coin.bitcoin);
|
|
||||||
mockito
|
|
||||||
.when(wallet.walletName)
|
|
||||||
.thenAnswer((realInvocation) => "wallet name");
|
|
||||||
mockito.when(wallet.balance).thenAnswer(
|
|
||||||
(_) => Balance(
|
|
||||||
coin: Coin.bitcoin,
|
|
||||||
total: _a(0),
|
|
||||||
spendable: _a(0),
|
|
||||||
blockedTotal: _a(0),
|
|
||||||
pendingSpendable: _a(0),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
final wallets = MockWallets();
|
|
||||||
final locale = MockLocaleService();
|
|
||||||
final manager = Manager(wallet);
|
|
||||||
final managerProvider = ChangeNotifierProvider((ref) => manager);
|
|
||||||
|
|
||||||
mockito
|
|
||||||
.when(wallets.getManagerProvider("wallet id"))
|
|
||||||
.thenAnswer((realInvocation) => managerProvider);
|
|
||||||
mockito.when(locale.locale).thenAnswer((_) => "en_US");
|
|
||||||
|
|
||||||
mockito
|
|
||||||
.when(wallets.getManagerProvider("wallet id"))
|
|
||||||
.thenAnswer((realInvocation) => managerProvider);
|
|
||||||
mockito
|
|
||||||
.when(wallets.getManager("wallet id"))
|
|
||||||
.thenAnswer((realInvocation) => manager);
|
|
||||||
|
|
||||||
final navigator = mockingjay.MockNavigator();
|
|
||||||
mockingjay
|
|
||||||
.when(() => navigator.pushNamed("/wallet",
|
|
||||||
arguments: Tuple2("wallet id", managerProvider)))
|
|
||||||
.thenAnswer((_) async => {});
|
|
||||||
|
|
||||||
await widgetTester.pumpWidget(
|
|
||||||
ProviderScope(
|
|
||||||
overrides: [
|
|
||||||
walletsChangeNotifierProvider.overrideWithValue(wallets),
|
|
||||||
localeServiceChangeNotifierProvider.overrideWithValue(locale),
|
|
||||||
],
|
|
||||||
child: MaterialApp(
|
|
||||||
theme: ThemeData(
|
|
||||||
extensions: [
|
|
||||||
StackColors.fromStackColorTheme(LightColors()),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
home: mockingjay.MockNavigatorProvider(
|
|
||||||
navigator: navigator,
|
|
||||||
child: const SimpleWalletCard(
|
|
||||||
walletId: "wallet id",
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
await widgetTester.pumpAndSettle();
|
|
||||||
|
|
||||||
expect(find.byType(MaterialButton), findsOneWidget);
|
|
||||||
await widgetTester.tap(find.byType(MaterialButton));
|
|
||||||
|
|
||||||
await widgetTester.pumpAndSettle();
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('test widget loads correctly', (widgetTester) async {
|
testWidgets('test widget loads correctly', (widgetTester) async {
|
||||||
final CoinServiceAPI wallet = MockBitcoinWallet();
|
final CoinServiceAPI wallet = MockBitcoinWallet();
|
||||||
mockito.when(wallet.walletId).thenAnswer((realInvocation) => "wallet id");
|
mockito.when(wallet.walletId).thenAnswer((realInvocation) => "wallet id");
|
||||||
|
@ -108,7 +37,6 @@ void main() {
|
||||||
.thenAnswer((realInvocation) => "wallet name");
|
.thenAnswer((realInvocation) => "wallet name");
|
||||||
mockito.when(wallet.balance).thenAnswer(
|
mockito.when(wallet.balance).thenAnswer(
|
||||||
(_) => Balance(
|
(_) => Balance(
|
||||||
coin: Coin.bitcoin,
|
|
||||||
total: _a(0),
|
total: _a(0),
|
||||||
spendable: _a(0),
|
spendable: _a(0),
|
||||||
blockedTotal: _a(0),
|
blockedTotal: _a(0),
|
||||||
|
|
|
@ -39,7 +39,6 @@ void main() {
|
||||||
when(wallet.walletId).thenAnswer((_) => "some-wallet-id");
|
when(wallet.walletId).thenAnswer((_) => "some-wallet-id");
|
||||||
when(wallet.balance).thenAnswer(
|
when(wallet.balance).thenAnswer(
|
||||||
(_) => Balance(
|
(_) => Balance(
|
||||||
coin: Coin.bitcoin,
|
|
||||||
total: Amount.zero,
|
total: Amount.zero,
|
||||||
spendable: Amount.zero,
|
spendable: Amount.zero,
|
||||||
blockedTotal: Amount.zero,
|
blockedTotal: Amount.zero,
|
||||||
|
|
|
@ -39,7 +39,6 @@ void main() {
|
||||||
when(wallet.walletId).thenAnswer((_) => "some-wallet-id");
|
when(wallet.walletId).thenAnswer((_) => "some-wallet-id");
|
||||||
when(wallet.balance).thenAnswer(
|
when(wallet.balance).thenAnswer(
|
||||||
(_) => Balance(
|
(_) => Balance(
|
||||||
coin: Coin.bitcoin,
|
|
||||||
total: Amount.zero,
|
total: Amount.zero,
|
||||||
spendable: Amount.zero,
|
spendable: Amount.zero,
|
||||||
blockedTotal: Amount.zero,
|
blockedTotal: Amount.zero,
|
||||||
|
|
Loading…
Reference in a new issue