mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-09 12:19:24 +00:00
Widget tests for managed_favorite, node_card, transaction_card and node_card_details
This commit is contained in:
parent
c8ec409efa
commit
d22746be52
7 changed files with 1391 additions and 726 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:ffi';
|
||||||
|
|
||||||
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';
|
||||||
|
@ -7,9 +9,11 @@ import 'package:stackwallet/providers/providers.dart';
|
||||||
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
|
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
|
||||||
import 'package:stackwallet/services/coins/coin_service.dart';
|
import 'package:stackwallet/services/coins/coin_service.dart';
|
||||||
import 'package:stackwallet/services/coins/manager.dart';
|
import 'package:stackwallet/services/coins/manager.dart';
|
||||||
|
import 'package:stackwallet/services/locale_service.dart';
|
||||||
import 'package:stackwallet/services/node_service.dart';
|
import 'package:stackwallet/services/node_service.dart';
|
||||||
import 'package:stackwallet/services/wallets.dart';
|
import 'package:stackwallet/services/wallets.dart';
|
||||||
import 'package:stackwallet/services/wallets_service.dart';
|
import 'package:stackwallet/services/wallets_service.dart';
|
||||||
|
import 'package:stackwallet/utilities/listenable_list.dart';
|
||||||
import 'package:stackwallet/widgets/managed_favorite.dart';
|
import 'package:stackwallet/widgets/managed_favorite.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/theme/light_colors.dart';
|
import 'package:stackwallet/utilities/theme/light_colors.dart';
|
||||||
|
@ -20,17 +24,18 @@ import 'managed_favorite_test.mocks.dart';
|
||||||
@GenerateMocks([
|
@GenerateMocks([
|
||||||
Wallets,
|
Wallets,
|
||||||
WalletsService,
|
WalletsService,
|
||||||
BitcoinWallet
|
BitcoinWallet,
|
||||||
|
LocaleService
|
||||||
], customMocks: [
|
], customMocks: [
|
||||||
MockSpec<NodeService>(returnNullOnMissingStub: true),
|
MockSpec<NodeService>(returnNullOnMissingStub: true),
|
||||||
MockSpec<Manager>(returnNullOnMissingStub: true),
|
MockSpec<Manager>(returnNullOnMissingStub: true),
|
||||||
MockSpec<CoinServiceAPI>(returnNullOnMissingStub: true),
|
MockSpec<CoinServiceAPI>(returnNullOnMissingStub: true),
|
||||||
// MockSpec<WalletsService>(returnNullOnMissingStub: true),
|
|
||||||
])
|
])
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets("Test wallet info row displays correctly", (widgetTester) async {
|
testWidgets("Test wallet info row displays correctly", (widgetTester) async {
|
||||||
final wallets = MockWallets();
|
final wallets = MockWallets();
|
||||||
final CoinServiceAPI wallet = MockBitcoinWallet();
|
final CoinServiceAPI wallet = MockBitcoinWallet();
|
||||||
|
|
||||||
when(wallet.coin).thenAnswer((_) => Coin.bitcoin);
|
when(wallet.coin).thenAnswer((_) => Coin.bitcoin);
|
||||||
when(wallet.walletName).thenAnswer((_) => "some wallet");
|
when(wallet.walletName).thenAnswer((_) => "some wallet");
|
||||||
when(wallet.walletId).thenAnswer((_) => "some wallet id");
|
when(wallet.walletId).thenAnswer((_) => "some wallet id");
|
||||||
|
@ -63,4 +68,124 @@ void main() {
|
||||||
|
|
||||||
expect(find.byType(ManagedFavorite), findsOneWidget);
|
expect(find.byType(ManagedFavorite), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets("Button Pressed - wallet unfavorite", (widgetTester) async {
|
||||||
|
final wallets = MockWallets();
|
||||||
|
final CoinServiceAPI wallet = MockBitcoinWallet();
|
||||||
|
final mockLocaleService = MockLocaleService();
|
||||||
|
final mockWalletsService = MockWalletsService();
|
||||||
|
|
||||||
|
when(wallet.coin).thenAnswer((_) => Coin.bitcoin);
|
||||||
|
when(wallet.walletName).thenAnswer((_) => "some wallet");
|
||||||
|
when(wallet.walletId).thenAnswer((_) => "some wallet id");
|
||||||
|
|
||||||
|
final manager = Manager(wallet);
|
||||||
|
|
||||||
|
when(wallets.getManager("some wallet id"))
|
||||||
|
.thenAnswer((realInvocation) => manager);
|
||||||
|
|
||||||
|
when(manager.isFavorite).thenAnswer((realInvocation) => false);
|
||||||
|
|
||||||
|
when(mockLocaleService.locale).thenAnswer((_) => "en_US");
|
||||||
|
|
||||||
|
when(wallets.getManagerProvider("some wallet id")).thenAnswer(
|
||||||
|
(realInvocation) => ChangeNotifierProvider((ref) => manager));
|
||||||
|
|
||||||
|
const managedFavorite = ManagedFavorite(walletId: "some wallet id");
|
||||||
|
|
||||||
|
final ListenableList<ChangeNotifierProvider<Manager>> favorites =
|
||||||
|
ListenableList();
|
||||||
|
|
||||||
|
final ListenableList<ChangeNotifierProvider<Manager>> nonfavorites =
|
||||||
|
ListenableList();
|
||||||
|
await widgetTester.pumpWidget(
|
||||||
|
ProviderScope(
|
||||||
|
overrides: [
|
||||||
|
walletsChangeNotifierProvider.overrideWithValue(wallets),
|
||||||
|
localeServiceChangeNotifierProvider
|
||||||
|
.overrideWithValue(mockLocaleService),
|
||||||
|
favoritesProvider.overrideWithValue(favorites),
|
||||||
|
nonFavoritesProvider.overrideWithValue(nonfavorites),
|
||||||
|
walletsServiceChangeNotifierProvider
|
||||||
|
.overrideWithValue(mockWalletsService)
|
||||||
|
],
|
||||||
|
child: MaterialApp(
|
||||||
|
theme: ThemeData(
|
||||||
|
extensions: [
|
||||||
|
StackColors.fromStackColorTheme(
|
||||||
|
LightColors(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
home: const Material(
|
||||||
|
child: managedFavorite,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(find.byType(RawMaterialButton), findsOneWidget);
|
||||||
|
await widgetTester.tap(find.byType(RawMaterialButton));
|
||||||
|
await widgetTester.pump();
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets("Button Pressed - wallet is favorite", (widgetTester) async {
|
||||||
|
final wallets = MockWallets();
|
||||||
|
final CoinServiceAPI wallet = MockBitcoinWallet();
|
||||||
|
final mockLocaleService = MockLocaleService();
|
||||||
|
final mockWalletsService = MockWalletsService();
|
||||||
|
|
||||||
|
when(wallet.coin).thenAnswer((_) => Coin.bitcoin);
|
||||||
|
when(wallet.walletName).thenAnswer((_) => "some wallet");
|
||||||
|
when(wallet.walletId).thenAnswer((_) => "some wallet id");
|
||||||
|
|
||||||
|
final manager = Manager(wallet);
|
||||||
|
|
||||||
|
when(wallets.getManager("some wallet id"))
|
||||||
|
.thenAnswer((realInvocation) => manager);
|
||||||
|
|
||||||
|
when(manager.isFavorite).thenAnswer((realInvocation) => true);
|
||||||
|
|
||||||
|
when(mockLocaleService.locale).thenAnswer((_) => "en_US");
|
||||||
|
|
||||||
|
when(wallets.getManagerProvider("some wallet id")).thenAnswer(
|
||||||
|
(realInvocation) => ChangeNotifierProvider((ref) => manager));
|
||||||
|
|
||||||
|
const managedFavorite = ManagedFavorite(walletId: "some wallet id");
|
||||||
|
|
||||||
|
final ListenableList<ChangeNotifierProvider<Manager>> favorites =
|
||||||
|
ListenableList();
|
||||||
|
|
||||||
|
final ListenableList<ChangeNotifierProvider<Manager>> nonfavorites =
|
||||||
|
ListenableList();
|
||||||
|
await widgetTester.pumpWidget(
|
||||||
|
ProviderScope(
|
||||||
|
overrides: [
|
||||||
|
walletsChangeNotifierProvider.overrideWithValue(wallets),
|
||||||
|
localeServiceChangeNotifierProvider
|
||||||
|
.overrideWithValue(mockLocaleService),
|
||||||
|
favoritesProvider.overrideWithValue(favorites),
|
||||||
|
nonFavoritesProvider.overrideWithValue(nonfavorites),
|
||||||
|
walletsServiceChangeNotifierProvider
|
||||||
|
.overrideWithValue(mockWalletsService)
|
||||||
|
],
|
||||||
|
child: MaterialApp(
|
||||||
|
theme: ThemeData(
|
||||||
|
extensions: [
|
||||||
|
StackColors.fromStackColorTheme(
|
||||||
|
LightColors(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
home: const Material(
|
||||||
|
child: managedFavorite,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(find.byType(RawMaterialButton), findsOneWidget);
|
||||||
|
await widgetTester.tap(find.byType(RawMaterialButton));
|
||||||
|
await widgetTester.pump();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,11 @@ import 'package:mockito/mockito.dart' as _i1;
|
||||||
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i11;
|
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i11;
|
||||||
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i10;
|
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i10;
|
||||||
import 'package:stackwallet/models/models.dart' as _i8;
|
import 'package:stackwallet/models/models.dart' as _i8;
|
||||||
import 'package:stackwallet/models/node_model.dart' as _i20;
|
import 'package:stackwallet/models/node_model.dart' as _i21;
|
||||||
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart' as _i19;
|
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart' as _i19;
|
||||||
import 'package:stackwallet/services/coins/coin_service.dart' as _i13;
|
import 'package:stackwallet/services/coins/coin_service.dart' as _i13;
|
||||||
import 'package:stackwallet/services/coins/manager.dart' as _i6;
|
import 'package:stackwallet/services/coins/manager.dart' as _i6;
|
||||||
|
import 'package:stackwallet/services/locale_service.dart' as _i20;
|
||||||
import 'package:stackwallet/services/node_service.dart' as _i3;
|
import 'package:stackwallet/services/node_service.dart' as _i3;
|
||||||
import 'package:stackwallet/services/transaction_notification_tracker.dart'
|
import 'package:stackwallet/services/transaction_notification_tracker.dart'
|
||||||
as _i7;
|
as _i7;
|
||||||
|
@ -1312,6 +1313,68 @@ class MockBitcoinWallet extends _i1.Mock implements _i19.BitcoinWallet {
|
||||||
) as _i16.Future<bool>);
|
) as _i16.Future<bool>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A class which mocks [LocaleService].
|
||||||
|
///
|
||||||
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
|
class MockLocaleService extends _i1.Mock implements _i20.LocaleService {
|
||||||
|
MockLocaleService() {
|
||||||
|
_i1.throwOnMissingStub(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get locale => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#locale),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
bool get hasListeners => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#hasListeners),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
_i16.Future<void> loadLocale({bool? notify = true}) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#loadLocale,
|
||||||
|
[],
|
||||||
|
{#notify: notify},
|
||||||
|
),
|
||||||
|
returnValue: _i16.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i16.Future<void>.value(),
|
||||||
|
) as _i16.Future<void>);
|
||||||
|
@override
|
||||||
|
void addListener(_i18.VoidCallback? listener) => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addListener,
|
||||||
|
[listener],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void removeListener(_i18.VoidCallback? listener) => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#removeListener,
|
||||||
|
[listener],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void dispose() => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#dispose,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void notifyListeners() => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#notifyListeners,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// A class which mocks [NodeService].
|
/// A class which mocks [NodeService].
|
||||||
///
|
///
|
||||||
/// See the documentation for Mockito's code generation for more information.
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
|
@ -1326,15 +1389,15 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService {
|
||||||
),
|
),
|
||||||
) as _i12.FlutterSecureStorageInterface);
|
) as _i12.FlutterSecureStorageInterface);
|
||||||
@override
|
@override
|
||||||
List<_i20.NodeModel> get primaryNodes => (super.noSuchMethod(
|
List<_i21.NodeModel> get primaryNodes => (super.noSuchMethod(
|
||||||
Invocation.getter(#primaryNodes),
|
Invocation.getter(#primaryNodes),
|
||||||
returnValue: <_i20.NodeModel>[],
|
returnValue: <_i21.NodeModel>[],
|
||||||
) as List<_i20.NodeModel>);
|
) as List<_i21.NodeModel>);
|
||||||
@override
|
@override
|
||||||
List<_i20.NodeModel> get nodes => (super.noSuchMethod(
|
List<_i21.NodeModel> get nodes => (super.noSuchMethod(
|
||||||
Invocation.getter(#nodes),
|
Invocation.getter(#nodes),
|
||||||
returnValue: <_i20.NodeModel>[],
|
returnValue: <_i21.NodeModel>[],
|
||||||
) as List<_i20.NodeModel>);
|
) as List<_i21.NodeModel>);
|
||||||
@override
|
@override
|
||||||
bool get hasListeners => (super.noSuchMethod(
|
bool get hasListeners => (super.noSuchMethod(
|
||||||
Invocation.getter(#hasListeners),
|
Invocation.getter(#hasListeners),
|
||||||
|
@ -1352,7 +1415,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService {
|
||||||
@override
|
@override
|
||||||
_i16.Future<void> setPrimaryNodeFor({
|
_i16.Future<void> setPrimaryNodeFor({
|
||||||
required _i15.Coin? coin,
|
required _i15.Coin? coin,
|
||||||
required _i20.NodeModel? node,
|
required _i21.NodeModel? node,
|
||||||
bool? shouldNotifyListeners = false,
|
bool? shouldNotifyListeners = false,
|
||||||
}) =>
|
}) =>
|
||||||
(super.noSuchMethod(
|
(super.noSuchMethod(
|
||||||
|
@ -1369,40 +1432,40 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService {
|
||||||
returnValueForMissingStub: _i16.Future<void>.value(),
|
returnValueForMissingStub: _i16.Future<void>.value(),
|
||||||
) as _i16.Future<void>);
|
) as _i16.Future<void>);
|
||||||
@override
|
@override
|
||||||
_i20.NodeModel? getPrimaryNodeFor({required _i15.Coin? coin}) =>
|
_i21.NodeModel? getPrimaryNodeFor({required _i15.Coin? coin}) =>
|
||||||
(super.noSuchMethod(Invocation.method(
|
(super.noSuchMethod(Invocation.method(
|
||||||
#getPrimaryNodeFor,
|
#getPrimaryNodeFor,
|
||||||
[],
|
[],
|
||||||
{#coin: coin},
|
{#coin: coin},
|
||||||
)) as _i20.NodeModel?);
|
)) as _i21.NodeModel?);
|
||||||
@override
|
@override
|
||||||
List<_i20.NodeModel> getNodesFor(_i15.Coin? coin) => (super.noSuchMethod(
|
List<_i21.NodeModel> getNodesFor(_i15.Coin? coin) => (super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#getNodesFor,
|
#getNodesFor,
|
||||||
[coin],
|
[coin],
|
||||||
),
|
),
|
||||||
returnValue: <_i20.NodeModel>[],
|
returnValue: <_i21.NodeModel>[],
|
||||||
) as List<_i20.NodeModel>);
|
) as List<_i21.NodeModel>);
|
||||||
@override
|
@override
|
||||||
_i20.NodeModel? getNodeById({required String? id}) =>
|
_i21.NodeModel? getNodeById({required String? id}) =>
|
||||||
(super.noSuchMethod(Invocation.method(
|
(super.noSuchMethod(Invocation.method(
|
||||||
#getNodeById,
|
#getNodeById,
|
||||||
[],
|
[],
|
||||||
{#id: id},
|
{#id: id},
|
||||||
)) as _i20.NodeModel?);
|
)) as _i21.NodeModel?);
|
||||||
@override
|
@override
|
||||||
List<_i20.NodeModel> failoverNodesFor({required _i15.Coin? coin}) =>
|
List<_i21.NodeModel> failoverNodesFor({required _i15.Coin? coin}) =>
|
||||||
(super.noSuchMethod(
|
(super.noSuchMethod(
|
||||||
Invocation.method(
|
Invocation.method(
|
||||||
#failoverNodesFor,
|
#failoverNodesFor,
|
||||||
[],
|
[],
|
||||||
{#coin: coin},
|
{#coin: coin},
|
||||||
),
|
),
|
||||||
returnValue: <_i20.NodeModel>[],
|
returnValue: <_i21.NodeModel>[],
|
||||||
) as List<_i20.NodeModel>);
|
) as List<_i21.NodeModel>);
|
||||||
@override
|
@override
|
||||||
_i16.Future<void> add(
|
_i16.Future<void> add(
|
||||||
_i20.NodeModel? node,
|
_i21.NodeModel? node,
|
||||||
String? password,
|
String? password,
|
||||||
bool? shouldNotifyListeners,
|
bool? shouldNotifyListeners,
|
||||||
) =>
|
) =>
|
||||||
|
@ -1454,7 +1517,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService {
|
||||||
) as _i16.Future<void>);
|
) as _i16.Future<void>);
|
||||||
@override
|
@override
|
||||||
_i16.Future<void> edit(
|
_i16.Future<void> edit(
|
||||||
_i20.NodeModel? editedNode,
|
_i21.NodeModel? editedNode,
|
||||||
String? password,
|
String? password,
|
||||||
bool? shouldNotifyListeners,
|
bool? shouldNotifyListeners,
|
||||||
) =>
|
) =>
|
||||||
|
|
|
@ -1,586 +1,204 @@
|
||||||
// import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
// import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
// import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
// import 'package:mockingjay/mockingjay.dart' as mockingjay;
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:mockito/annotations.dart';
|
import 'package:mockito/annotations.dart';
|
||||||
// import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
|
import 'package:stackwallet/models/node_model.dart';
|
||||||
|
import 'package:stackwallet/providers/providers.dart';
|
||||||
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
|
import 'package:stackwallet/utilities/theme/light_colors.dart';
|
||||||
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
import 'package:stackwallet/services/node_service.dart';
|
import 'package:stackwallet/services/node_service.dart';
|
||||||
// import 'package:stackwallet/widgets/node_card.dart';
|
import 'package:stackwallet/widgets/node_card.dart';
|
||||||
|
import 'package:stackwallet/widgets/node_options_sheet.dart';
|
||||||
|
|
||||||
// import 'node_card_test.mocks.dart';
|
import 'node_card_test.mocks.dart';
|
||||||
|
|
||||||
@GenerateMocks([], customMocks: [
|
@GenerateMocks([NodeService])
|
||||||
MockSpec<NodeService>(returnNullOnMissingStub: true),
|
|
||||||
])
|
|
||||||
void main() {
|
void main() {
|
||||||
// testWidgets("NodeCard builds inactive node correctly", (tester) async {
|
testWidgets("NodeCard builds inactive node correctly", (tester) async {
|
||||||
// final nodeService = MockNodeService();
|
final nodeService = MockNodeService();
|
||||||
//
|
|
||||||
// when(nodeService.activeNodeName).thenAnswer((_) => "some other node");
|
when(nodeService.getPrimaryNodeFor(coin: Coin.bitcoin)).thenAnswer(
|
||||||
//
|
(realInvocation) => NodeModel(
|
||||||
// await tester.pumpWidget(
|
host: "127.0.0.1",
|
||||||
// MaterialApp(
|
port: 2000,
|
||||||
// home: MultiProvider(
|
name: "Stack Default",
|
||||||
// providers: [
|
id: "node id",
|
||||||
// ChangeNotifierProvider<NodeService>(
|
useSSL: true,
|
||||||
// create: (_) => nodeService,
|
enabled: true,
|
||||||
// ),
|
coinName: "Bitcoin",
|
||||||
// ],
|
isFailover: false,
|
||||||
// child: NodeCard(
|
isDown: false));
|
||||||
// nodeName: "Campfire default",
|
|
||||||
// nodeData: {
|
when(nodeService.getNodeById(id: "node id")).thenAnswer((realInvocation) =>
|
||||||
// "port": "9000",
|
NodeModel(
|
||||||
// "ipAddress": "some url",
|
host: "127.0.0.1",
|
||||||
// "useSSL": true,
|
port: 2000,
|
||||||
// },
|
name: "some other name",
|
||||||
// ),
|
id: "node id",
|
||||||
// ),
|
useSSL: true,
|
||||||
// ),
|
enabled: true,
|
||||||
// );
|
coinName: "Bitcoin",
|
||||||
// await tester.pumpAndSettle();
|
isFailover: false,
|
||||||
//
|
isDown: false));
|
||||||
// expect(find.text("Campfire default"), findsOneWidget);
|
|
||||||
// expect(find.byType(Text), findsOneWidget);
|
await tester.pumpWidget(
|
||||||
// expect(find.byType(SvgPicture), findsOneWidget);
|
ProviderScope(
|
||||||
//
|
overrides: [
|
||||||
// verify(nodeService.activeNodeName).called(1);
|
nodeServiceChangeNotifierProvider.overrideWithValue(nodeService),
|
||||||
// verify(nodeService.addListener(any)).called(1);
|
],
|
||||||
//
|
child: MaterialApp(
|
||||||
// verifyNoMoreInteractions(nodeService);
|
theme: ThemeData(
|
||||||
// });
|
extensions: [
|
||||||
//
|
StackColors.fromStackColorTheme(
|
||||||
// testWidgets("NodeCard builds active node correctly", (tester) async {
|
LightColors(),
|
||||||
// final nodeService = MockNodeService();
|
),
|
||||||
//
|
],
|
||||||
// when(nodeService.activeNodeName).thenAnswer((_) => "Campfire default");
|
),
|
||||||
//
|
home: const NodeCard(
|
||||||
// await tester.pumpWidget(
|
nodeId: "node id", coin: Coin.bitcoin, popBackToRoute: ""),
|
||||||
// MaterialApp(
|
),
|
||||||
// home: MultiProvider(
|
),
|
||||||
// providers: [
|
);
|
||||||
// ChangeNotifierProvider<NodeService>(
|
|
||||||
// create: (_) => nodeService,
|
await tester.pumpAndSettle();
|
||||||
// ),
|
|
||||||
// ],
|
expect(find.text("some other name"), findsOneWidget);
|
||||||
// child: NodeCard(
|
expect(find.text("Disconnected"), findsOneWidget);
|
||||||
// nodeName: "Campfire default",
|
expect(find.byType(SvgPicture), findsWidgets);
|
||||||
// nodeData: {
|
|
||||||
// "port": "9000",
|
verify(nodeService.getPrimaryNodeFor(coin: Coin.bitcoin)).called(1);
|
||||||
// "ipAddress": "some url",
|
verify(nodeService.getNodeById(id: "node id")).called(1);
|
||||||
// "useSSL": true,
|
verify(nodeService.addListener(any)).called(1);
|
||||||
// },
|
verifyNoMoreInteractions(nodeService);
|
||||||
// ),
|
});
|
||||||
// ),
|
|
||||||
// ),
|
testWidgets("NodeCard builds active node correctly", (tester) async {
|
||||||
// );
|
final nodeService = MockNodeService();
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
when(nodeService.getPrimaryNodeFor(coin: Coin.bitcoin)).thenAnswer(
|
||||||
// expect(find.text("Campfire default"), findsOneWidget);
|
(realInvocation) => NodeModel(
|
||||||
// expect(find.text("Connected"), findsOneWidget);
|
host: "127.0.0.1",
|
||||||
// expect(find.byType(Text), findsNWidgets(2));
|
port: 2000,
|
||||||
// expect(find.byType(SvgPicture), findsOneWidget);
|
name: "Stack Default",
|
||||||
//
|
id: "node id",
|
||||||
// verify(nodeService.activeNodeName).called(1);
|
useSSL: true,
|
||||||
// verify(nodeService.addListener(any)).called(1);
|
enabled: true,
|
||||||
//
|
coinName: "Bitcoin",
|
||||||
// verifyNoMoreInteractions(nodeService);
|
isFailover: false,
|
||||||
// });
|
isDown: false));
|
||||||
//
|
|
||||||
// testWidgets("tap to open context menu on default node", (tester) async {
|
when(nodeService.getNodeById(id: "node id")).thenAnswer((realInvocation) =>
|
||||||
// final nodeService = MockNodeService();
|
NodeModel(
|
||||||
//
|
host: "127.0.0.1",
|
||||||
// when(nodeService.activeNodeName).thenAnswer((_) => "Campfire default");
|
port: 2000,
|
||||||
//
|
name: "Stack Default",
|
||||||
// await tester.pumpWidget(
|
id: "node id",
|
||||||
// MaterialApp(
|
useSSL: true,
|
||||||
// home: MultiProvider(
|
enabled: true,
|
||||||
// providers: [
|
coinName: "Bitcoin",
|
||||||
// ChangeNotifierProvider<NodeService>(
|
isFailover: false,
|
||||||
// create: (_) => nodeService,
|
isDown: false));
|
||||||
// ),
|
|
||||||
// ],
|
await tester.pumpWidget(
|
||||||
// child: NodeCard(
|
ProviderScope(
|
||||||
// nodeName: "Campfire default",
|
overrides: [
|
||||||
// nodeData: {
|
nodeServiceChangeNotifierProvider.overrideWithValue(nodeService),
|
||||||
// "port": "9000",
|
],
|
||||||
// "ipAddress": "some url",
|
child: MaterialApp(
|
||||||
// "useSSL": true,
|
theme: ThemeData(
|
||||||
// },
|
extensions: [
|
||||||
// ),
|
StackColors.fromStackColorTheme(
|
||||||
// ),
|
LightColors(),
|
||||||
// ),
|
),
|
||||||
// );
|
],
|
||||||
// await tester.pumpAndSettle();
|
),
|
||||||
//
|
home: const NodeCard(
|
||||||
// expect(find.text("Campfire default"), findsOneWidget);
|
nodeId: "node id", coin: Coin.bitcoin, popBackToRoute: ""),
|
||||||
// expect(find.text("Connected"), findsOneWidget);
|
),
|
||||||
// expect(find.byType(Text), findsNWidgets(2));
|
),
|
||||||
// expect(find.byType(SvgPicture), findsOneWidget);
|
);
|
||||||
//
|
await tester.pumpAndSettle();
|
||||||
// await tester.tap(find.byType(NodeCard));
|
|
||||||
// await tester.pumpAndSettle();
|
expect(find.text("Stack Default"), findsOneWidget);
|
||||||
//
|
expect(find.text("Connected"), findsOneWidget);
|
||||||
// expect(find.text("Connect"), findsOneWidget);
|
expect(find.byType(Text), findsNWidgets(2));
|
||||||
// expect(find.text("Details"), findsOneWidget);
|
expect(find.byType(SvgPicture), findsWidgets);
|
||||||
// expect(find.byType(Text), findsNWidgets(4));
|
|
||||||
//
|
verify(nodeService.getPrimaryNodeFor(coin: Coin.bitcoin)).called(1);
|
||||||
// verify(nodeService.activeNodeName).called(1);
|
verify(nodeService.getNodeById(id: "node id")).called(1);
|
||||||
// verify(nodeService.addListener(any)).called(1);
|
verify(nodeService.addListener(any)).called(1);
|
||||||
//
|
|
||||||
// verifyNoMoreInteractions(nodeService);
|
verifyNoMoreInteractions(nodeService);
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// testWidgets("tap to open context menu on any other node", (tester) async {
|
testWidgets("tap to open context menu on default node", (tester) async {
|
||||||
// final nodeService = MockNodeService();
|
final nodeService = MockNodeService();
|
||||||
//
|
|
||||||
// when(nodeService.activeNodeName).thenAnswer((_) => "Campfire default");
|
when(nodeService.getPrimaryNodeFor(coin: Coin.bitcoin)).thenAnswer(
|
||||||
//
|
(realInvocation) => NodeModel(
|
||||||
// await tester.pumpWidget(
|
host: "127.0.0.1",
|
||||||
// MaterialApp(
|
port: 2000,
|
||||||
// home: MultiProvider(
|
name: "Stack Default",
|
||||||
// providers: [
|
id: "node id",
|
||||||
// ChangeNotifierProvider<NodeService>(
|
useSSL: true,
|
||||||
// create: (_) => nodeService,
|
enabled: true,
|
||||||
// ),
|
coinName: "Bitcoin",
|
||||||
// ],
|
isFailover: false,
|
||||||
// child: NodeCard(
|
isDown: false));
|
||||||
// nodeName: "some other node",
|
|
||||||
// nodeData: {
|
when(nodeService.getNodeById(id: "node id")).thenAnswer((realInvocation) =>
|
||||||
// "port": "9000",
|
NodeModel(
|
||||||
// "ipAddress": "some url",
|
host: "127.0.0.1",
|
||||||
// "useSSL": true,
|
port: 2000,
|
||||||
// },
|
name: "Stack Default",
|
||||||
// ),
|
id: "node id",
|
||||||
// ),
|
useSSL: true,
|
||||||
// ),
|
enabled: true,
|
||||||
// );
|
coinName: "Bitcoin",
|
||||||
// await tester.pumpAndSettle();
|
isFailover: false,
|
||||||
//
|
isDown: false));
|
||||||
// expect(find.text("some other node"), findsOneWidget);
|
|
||||||
// expect(find.byType(Text), findsNWidgets(1));
|
await tester.pumpWidget(
|
||||||
// expect(find.byType(SvgPicture), findsOneWidget);
|
ProviderScope(
|
||||||
//
|
overrides: [
|
||||||
// await tester.tap(find.byType(NodeCard));
|
nodeServiceChangeNotifierProvider.overrideWithValue(nodeService),
|
||||||
// await tester.pumpAndSettle();
|
],
|
||||||
//
|
child: MaterialApp(
|
||||||
// expect(find.text("Connect"), findsOneWidget);
|
theme: ThemeData(
|
||||||
// expect(find.text("Details"), findsOneWidget);
|
extensions: [
|
||||||
// expect(find.text("Edit"), findsOneWidget);
|
StackColors.fromStackColorTheme(
|
||||||
// expect(find.text("Delete"), findsOneWidget);
|
LightColors(),
|
||||||
// expect(find.byType(Text), findsNWidgets(5));
|
),
|
||||||
//
|
],
|
||||||
// verify(nodeService.activeNodeName).called(1);
|
),
|
||||||
// verify(nodeService.addListener(any)).called(1);
|
home: const NodeCard(
|
||||||
//
|
nodeId: "node id", coin: Coin.bitcoin, popBackToRoute: ""),
|
||||||
// verifyNoMoreInteractions(nodeService);
|
),
|
||||||
// });
|
),
|
||||||
//
|
);
|
||||||
// testWidgets("tap connect", (tester) async {
|
|
||||||
// final nodeService = MockNodeService();
|
await tester.pumpAndSettle();
|
||||||
// final navigator = mockingjay.MockNavigator();
|
|
||||||
//
|
expect(find.text("Stack Default"), findsOneWidget);
|
||||||
// when(nodeService.activeNodeName).thenAnswer((_) => "Campfire default");
|
expect(find.text("Connected"), findsOneWidget);
|
||||||
// when(nodeService.setCurrentNode("some other node"))
|
expect(find.byType(Text), findsNWidgets(2));
|
||||||
// .thenAnswer((_) async {});
|
expect(find.byType(SvgPicture), findsNWidgets(2));
|
||||||
//
|
|
||||||
// mockingjay.when(() => navigator.pop()).thenAnswer((_) {});
|
await tester.tap(find.byType(NodeCard));
|
||||||
//
|
await tester.pumpAndSettle();
|
||||||
// await tester.pumpWidget(
|
|
||||||
// MaterialApp(
|
expect(find.text("Connect"), findsOneWidget);
|
||||||
// home: mockingjay.MockNavigatorProvider(
|
expect(find.text("Details"), findsOneWidget);
|
||||||
// navigator: navigator,
|
expect(find.byType(NodeOptionsSheet), findsOneWidget);
|
||||||
// child: MultiProvider(
|
expect(find.byType(Text), findsNWidgets(7));
|
||||||
// providers: [
|
|
||||||
// ChangeNotifierProvider<NodeService>(
|
verify(nodeService.getPrimaryNodeFor(coin: Coin.bitcoin)).called(2);
|
||||||
// create: (_) => nodeService,
|
verify(nodeService.getNodeById(id: "node id")).called(2);
|
||||||
// ),
|
verify(nodeService.addListener(any)).called(1);
|
||||||
// ],
|
|
||||||
// child: NodeCard(
|
verifyNoMoreInteractions(nodeService);
|
||||||
// nodeName: "some other node",
|
});
|
||||||
// nodeData: {
|
|
||||||
// "port": "9000",
|
|
||||||
// "ipAddress": "some url",
|
|
||||||
// "useSSL": true,
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// expect(find.text("some other node"), findsOneWidget);
|
|
||||||
// expect(find.byType(Text), findsNWidgets(1));
|
|
||||||
// expect(find.byType(SvgPicture), findsOneWidget);
|
|
||||||
//
|
|
||||||
// await tester.tap(find.byType(NodeCard));
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// expect(find.text("Connect"), findsOneWidget);
|
|
||||||
// expect(find.text("Details"), findsOneWidget);
|
|
||||||
// expect(find.text("Edit"), findsOneWidget);
|
|
||||||
// expect(find.text("Delete"), findsOneWidget);
|
|
||||||
// expect(find.byType(Text), findsNWidgets(5));
|
|
||||||
//
|
|
||||||
// await tester.tap(find.text("Connect"));
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// verify(nodeService.activeNodeName).called(1);
|
|
||||||
// verify(nodeService.addListener(any)).called(1);
|
|
||||||
// verify(nodeService.setCurrentNode("some other node")).called(1);
|
|
||||||
//
|
|
||||||
// verifyNoMoreInteractions(nodeService);
|
|
||||||
//
|
|
||||||
// mockingjay.verify(() => navigator.pop()).called(1);
|
|
||||||
// mockingjay.verifyNoMoreInteractions(navigator);
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// testWidgets("tap details", (tester) async {
|
|
||||||
// final nodeService = MockNodeService();
|
|
||||||
// final navigator = mockingjay.MockNavigator();
|
|
||||||
//
|
|
||||||
// when(nodeService.activeNodeName).thenAnswer((_) => "Campfire default");
|
|
||||||
//
|
|
||||||
// mockingjay.when(() => navigator.pop()).thenAnswer((_) {});
|
|
||||||
// mockingjay
|
|
||||||
// .when(() => navigator.push(mockingjay.any()))
|
|
||||||
// .thenAnswer((_) async {});
|
|
||||||
//
|
|
||||||
// await tester.pumpWidget(
|
|
||||||
// MaterialApp(
|
|
||||||
// home: mockingjay.MockNavigatorProvider(
|
|
||||||
// navigator: navigator,
|
|
||||||
// child: MultiProvider(
|
|
||||||
// providers: [
|
|
||||||
// ChangeNotifierProvider<NodeService>(
|
|
||||||
// create: (_) => nodeService,
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// child: NodeCard(
|
|
||||||
// nodeName: "some other node",
|
|
||||||
// nodeData: {
|
|
||||||
// "port": "9000",
|
|
||||||
// "ipAddress": "some url",
|
|
||||||
// "useSSL": true,
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// expect(find.text("some other node"), findsOneWidget);
|
|
||||||
// expect(find.byType(Text), findsNWidgets(1));
|
|
||||||
// expect(find.byType(SvgPicture), findsOneWidget);
|
|
||||||
//
|
|
||||||
// await tester.tap(find.byType(NodeCard));
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// expect(find.text("Connect"), findsOneWidget);
|
|
||||||
// expect(find.text("Details"), findsOneWidget);
|
|
||||||
// expect(find.text("Edit"), findsOneWidget);
|
|
||||||
// expect(find.text("Delete"), findsOneWidget);
|
|
||||||
// expect(find.byType(Text), findsNWidgets(5));
|
|
||||||
//
|
|
||||||
// await tester.tap(find.text("Details"));
|
|
||||||
// await tester.pump();
|
|
||||||
//
|
|
||||||
// verify(nodeService.activeNodeName).called(1);
|
|
||||||
// verify(nodeService.addListener(any)).called(1);
|
|
||||||
//
|
|
||||||
// verifyNoMoreInteractions(nodeService);
|
|
||||||
//
|
|
||||||
// mockingjay.verify(() => navigator.pop()).called(1);
|
|
||||||
// mockingjay
|
|
||||||
// .verify(() => navigator.push(mockingjay.any(
|
|
||||||
// that: mockingjay.isRoute(whereName: equals("/nodedetailsview")))))
|
|
||||||
// .called(1);
|
|
||||||
//
|
|
||||||
// mockingjay.verifyNoMoreInteractions(navigator);
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// testWidgets("tap edit", (tester) async {
|
|
||||||
// final nodeService = MockNodeService();
|
|
||||||
// final navigator = mockingjay.MockNavigator();
|
|
||||||
//
|
|
||||||
// when(nodeService.activeNodeName).thenAnswer((_) => "Campfire default");
|
|
||||||
//
|
|
||||||
// mockingjay.when(() => navigator.pop()).thenAnswer((_) {});
|
|
||||||
// mockingjay
|
|
||||||
// .when(() => navigator.push(mockingjay.any()))
|
|
||||||
// .thenAnswer((_) async {});
|
|
||||||
//
|
|
||||||
// await tester.pumpWidget(
|
|
||||||
// MaterialApp(
|
|
||||||
// home: mockingjay.MockNavigatorProvider(
|
|
||||||
// navigator: navigator,
|
|
||||||
// child: MultiProvider(
|
|
||||||
// providers: [
|
|
||||||
// ChangeNotifierProvider<NodeService>(
|
|
||||||
// create: (_) => nodeService,
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// child: NodeCard(
|
|
||||||
// nodeName: "some other node",
|
|
||||||
// nodeData: {
|
|
||||||
// "port": "9000",
|
|
||||||
// "ipAddress": "some url",
|
|
||||||
// "useSSL": true,
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// expect(find.text("some other node"), findsOneWidget);
|
|
||||||
// expect(find.byType(Text), findsNWidgets(1));
|
|
||||||
// expect(find.byType(SvgPicture), findsOneWidget);
|
|
||||||
//
|
|
||||||
// await tester.tap(find.byType(NodeCard));
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// expect(find.text("Connect"), findsOneWidget);
|
|
||||||
// expect(find.text("Details"), findsOneWidget);
|
|
||||||
// expect(find.text("Edit"), findsOneWidget);
|
|
||||||
// expect(find.text("Delete"), findsOneWidget);
|
|
||||||
// expect(find.byType(Text), findsNWidgets(5));
|
|
||||||
//
|
|
||||||
// await tester.tap(find.text("Edit"));
|
|
||||||
// await tester.pump();
|
|
||||||
//
|
|
||||||
// verify(nodeService.activeNodeName).called(1);
|
|
||||||
// verify(nodeService.addListener(any)).called(1);
|
|
||||||
//
|
|
||||||
// verifyNoMoreInteractions(nodeService);
|
|
||||||
//
|
|
||||||
// mockingjay.verify(() => navigator.pop()).called(1);
|
|
||||||
// mockingjay
|
|
||||||
// .verify(() => navigator.push(mockingjay.any(
|
|
||||||
// that:
|
|
||||||
// mockingjay.isRoute(whereName: equals("/editnodedetailsview")))))
|
|
||||||
// .called(1);
|
|
||||||
//
|
|
||||||
// mockingjay.verifyNoMoreInteractions(navigator);
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// testWidgets("tap delete and cancel", (tester) async {
|
|
||||||
// final nodeService = MockNodeService();
|
|
||||||
// final navigator = mockingjay.MockNavigator();
|
|
||||||
//
|
|
||||||
// when(nodeService.activeNodeName).thenAnswer((_) => "Campfire default");
|
|
||||||
//
|
|
||||||
// mockingjay.when(() => navigator.pop()).thenAnswer((_) {});
|
|
||||||
//
|
|
||||||
// await tester.pumpWidget(
|
|
||||||
// MaterialApp(
|
|
||||||
// home: mockingjay.MockNavigatorProvider(
|
|
||||||
// navigator: navigator,
|
|
||||||
// child: MultiProvider(
|
|
||||||
// providers: [
|
|
||||||
// ChangeNotifierProvider<NodeService>(
|
|
||||||
// create: (_) => nodeService,
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// child: NodeCard(
|
|
||||||
// nodeName: "some other node",
|
|
||||||
// nodeData: {
|
|
||||||
// "port": "9000",
|
|
||||||
// "ipAddress": "some url",
|
|
||||||
// "useSSL": true,
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// expect(find.text("some other node"), findsOneWidget);
|
|
||||||
// expect(find.byType(Text), findsNWidgets(1));
|
|
||||||
// expect(find.byType(SvgPicture), findsOneWidget);
|
|
||||||
//
|
|
||||||
// await tester.tap(find.byType(NodeCard));
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// expect(find.text("Connect"), findsOneWidget);
|
|
||||||
// expect(find.text("Details"), findsOneWidget);
|
|
||||||
// expect(find.text("Edit"), findsOneWidget);
|
|
||||||
// expect(find.text("Delete"), findsOneWidget);
|
|
||||||
// expect(find.byType(Text), findsNWidgets(5));
|
|
||||||
//
|
|
||||||
// await tester.tap(find.text("Delete"));
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// expect(find.byType(ModalPopupDialog), findsOneWidget);
|
|
||||||
// expect(find.byType(SimpleButton), findsOneWidget);
|
|
||||||
// expect(find.byType(GradientButton), findsOneWidget);
|
|
||||||
// expect(find.text("CANCEL"), findsOneWidget);
|
|
||||||
// expect(find.text("DELETE"), findsOneWidget);
|
|
||||||
// expect(find.text("Do you want to delete some other node?"), findsOneWidget);
|
|
||||||
//
|
|
||||||
// await tester.tap(find.byType(SimpleButton));
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// verify(nodeService.activeNodeName).called(1);
|
|
||||||
// verify(nodeService.addListener(any)).called(1);
|
|
||||||
//
|
|
||||||
// verifyNoMoreInteractions(nodeService);
|
|
||||||
//
|
|
||||||
// mockingjay.verify(() => navigator.pop()).called(2);
|
|
||||||
//
|
|
||||||
// mockingjay.verifyNoMoreInteractions(navigator);
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// testWidgets("tap delete and confirm fails", (tester) async {
|
|
||||||
// final nodeService = MockNodeService();
|
|
||||||
// final navigator = mockingjay.MockNavigator();
|
|
||||||
//
|
|
||||||
// when(nodeService.activeNodeName).thenAnswer((_) => "Campfire default");
|
|
||||||
// when(nodeService.deleteNode("some other node"))
|
|
||||||
// .thenAnswer((_) async => false);
|
|
||||||
//
|
|
||||||
// mockingjay.when(() => navigator.pop()).thenAnswer((_) {});
|
|
||||||
//
|
|
||||||
// await tester.pumpWidget(
|
|
||||||
// MaterialApp(
|
|
||||||
// home: mockingjay.MockNavigatorProvider(
|
|
||||||
// navigator: navigator,
|
|
||||||
// child: MultiProvider(
|
|
||||||
// providers: [
|
|
||||||
// ChangeNotifierProvider<NodeService>(
|
|
||||||
// create: (_) => nodeService,
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// child: NodeCard(
|
|
||||||
// nodeName: "some other node",
|
|
||||||
// nodeData: {
|
|
||||||
// "port": "9000",
|
|
||||||
// "ipAddress": "some url",
|
|
||||||
// "useSSL": true,
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// expect(find.text("some other node"), findsOneWidget);
|
|
||||||
// expect(find.byType(Text), findsNWidgets(1));
|
|
||||||
// expect(find.byType(SvgPicture), findsOneWidget);
|
|
||||||
//
|
|
||||||
// await tester.tap(find.byType(NodeCard));
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// expect(find.text("Connect"), findsOneWidget);
|
|
||||||
// expect(find.text("Details"), findsOneWidget);
|
|
||||||
// expect(find.text("Edit"), findsOneWidget);
|
|
||||||
// expect(find.text("Delete"), findsOneWidget);
|
|
||||||
// expect(find.byType(Text), findsNWidgets(5));
|
|
||||||
//
|
|
||||||
// await tester.tap(find.text("Delete"));
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// expect(find.byType(ModalPopupDialog), findsOneWidget);
|
|
||||||
// expect(find.byType(SimpleButton), findsOneWidget);
|
|
||||||
// expect(find.byType(GradientButton), findsOneWidget);
|
|
||||||
// expect(find.text("CANCEL"), findsOneWidget);
|
|
||||||
// expect(find.text("DELETE"), findsOneWidget);
|
|
||||||
// expect(find.text("Do you want to delete some other node?"), findsOneWidget);
|
|
||||||
//
|
|
||||||
// await tester.tap(find.byType(GradientButton));
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// expect(find.byType(CampfireAlert), findsOneWidget);
|
|
||||||
// expect(find.text("Error: Could not delete node named \"some other node\"!"),
|
|
||||||
// findsOneWidget);
|
|
||||||
//
|
|
||||||
// verify(nodeService.activeNodeName).called(1);
|
|
||||||
// verify(nodeService.addListener(any)).called(1);
|
|
||||||
// verify(nodeService.deleteNode("some other node")).called(1);
|
|
||||||
//
|
|
||||||
// verifyNoMoreInteractions(nodeService);
|
|
||||||
//
|
|
||||||
// mockingjay.verify(() => navigator.pop()).called(2);
|
|
||||||
//
|
|
||||||
// mockingjay.verifyNoMoreInteractions(navigator);
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// testWidgets("tap delete and confirm succeeds", (tester) async {
|
|
||||||
// final nodeService = MockNodeService();
|
|
||||||
// final navigator = mockingjay.MockNavigator();
|
|
||||||
//
|
|
||||||
// when(nodeService.activeNodeName).thenAnswer((_) => "Campfire default");
|
|
||||||
// when(nodeService.deleteNode("some other node"))
|
|
||||||
// .thenAnswer((_) async => true);
|
|
||||||
//
|
|
||||||
// mockingjay.when(() => navigator.pop()).thenAnswer((_) {});
|
|
||||||
//
|
|
||||||
// await tester.pumpWidget(
|
|
||||||
// MaterialApp(
|
|
||||||
// home: mockingjay.MockNavigatorProvider(
|
|
||||||
// navigator: navigator,
|
|
||||||
// child: MultiProvider(
|
|
||||||
// providers: [
|
|
||||||
// ChangeNotifierProvider<NodeService>(
|
|
||||||
// create: (_) => nodeService,
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// child: NodeCard(
|
|
||||||
// nodeName: "some other node",
|
|
||||||
// nodeData: {
|
|
||||||
// "port": "9000",
|
|
||||||
// "ipAddress": "some url",
|
|
||||||
// "useSSL": true,
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// expect(find.text("some other node"), findsOneWidget);
|
|
||||||
// expect(find.byType(Text), findsNWidgets(1));
|
|
||||||
// expect(find.byType(SvgPicture), findsOneWidget);
|
|
||||||
//
|
|
||||||
// await tester.tap(find.byType(NodeCard));
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// expect(find.text("Connect"), findsOneWidget);
|
|
||||||
// expect(find.text("Details"), findsOneWidget);
|
|
||||||
// expect(find.text("Edit"), findsOneWidget);
|
|
||||||
// expect(find.text("Delete"), findsOneWidget);
|
|
||||||
// expect(find.byType(Text), findsNWidgets(5));
|
|
||||||
//
|
|
||||||
// await tester.tap(find.text("Delete"));
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// expect(find.byType(ModalPopupDialog), findsOneWidget);
|
|
||||||
// expect(find.byType(SimpleButton), findsOneWidget);
|
|
||||||
// expect(find.byType(GradientButton), findsOneWidget);
|
|
||||||
// expect(find.text("CANCEL"), findsOneWidget);
|
|
||||||
// expect(find.text("DELETE"), findsOneWidget);
|
|
||||||
// expect(find.text("Do you want to delete some other node?"), findsOneWidget);
|
|
||||||
//
|
|
||||||
// await tester.tap(find.byType(GradientButton));
|
|
||||||
// await tester.pumpAndSettle();
|
|
||||||
//
|
|
||||||
// expect(find.byType(CampfireAlert), findsNothing);
|
|
||||||
// expect(find.text("Error: Could not delete node named \"some other node\"!"),
|
|
||||||
// findsNothing);
|
|
||||||
//
|
|
||||||
// verify(nodeService.activeNodeName).called(1);
|
|
||||||
// verify(nodeService.addListener(any)).called(1);
|
|
||||||
// verify(nodeService.deleteNode("some other node")).called(1);
|
|
||||||
//
|
|
||||||
// verifyNoMoreInteractions(nodeService);
|
|
||||||
//
|
|
||||||
// mockingjay.verify(() => navigator.pop()).called(2);
|
|
||||||
//
|
|
||||||
// mockingjay.verifyNoMoreInteractions(navigator);
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,10 @@ class _FakeFlutterSecureStorageInterface_0 extends _i1.SmartFake
|
||||||
///
|
///
|
||||||
/// See the documentation for Mockito's code generation for more information.
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
class MockNodeService extends _i1.Mock implements _i3.NodeService {
|
class MockNodeService extends _i1.Mock implements _i3.NodeService {
|
||||||
|
MockNodeService() {
|
||||||
|
_i1.throwOnMissingStub(this);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_i2.FlutterSecureStorageInterface get secureStorageInterface =>
|
_i2.FlutterSecureStorageInterface get secureStorageInterface =>
|
||||||
(super.noSuchMethod(
|
(super.noSuchMethod(
|
||||||
|
|
154
test/widget_tests/node_options_sheet_test.dart
Normal file
154
test/widget_tests/node_options_sheet_test.dart
Normal file
|
@ -0,0 +1,154 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:mockito/annotations.dart';
|
||||||
|
import 'package:mockito/mockito.dart';
|
||||||
|
import 'package:stackwallet/models/node_model.dart';
|
||||||
|
import 'package:mockingjay/mockingjay.dart' as mockingjay;
|
||||||
|
import 'package:stackwallet/providers/providers.dart';
|
||||||
|
import 'package:stackwallet/services/wallets.dart';
|
||||||
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
|
import 'package:stackwallet/utilities/prefs.dart';
|
||||||
|
import 'package:stackwallet/utilities/theme/light_colors.dart';
|
||||||
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
|
import 'package:stackwallet/services/node_service.dart';
|
||||||
|
import 'package:stackwallet/widgets/node_options_sheet.dart';
|
||||||
|
import 'package:tuple/tuple.dart';
|
||||||
|
|
||||||
|
import 'node_options_sheet_test.mocks.dart';
|
||||||
|
|
||||||
|
@GenerateMocks([Wallets, Prefs, NodeService])
|
||||||
|
void main() {
|
||||||
|
testWidgets("Load Node Options widget", (tester) async {
|
||||||
|
final mockWallets = MockWallets();
|
||||||
|
final mockPrefs = MockPrefs();
|
||||||
|
final mockNodeService = MockNodeService();
|
||||||
|
|
||||||
|
when(mockNodeService.getNodeById(id: "node id")).thenAnswer(
|
||||||
|
(realInvocation) => NodeModel(
|
||||||
|
host: "127.0.0.1",
|
||||||
|
port: 2000,
|
||||||
|
name: "Stack Default",
|
||||||
|
id: "node id",
|
||||||
|
useSSL: true,
|
||||||
|
enabled: true,
|
||||||
|
coinName: "Bitcoin",
|
||||||
|
isFailover: false,
|
||||||
|
isDown: false));
|
||||||
|
|
||||||
|
when(mockNodeService.getPrimaryNodeFor(coin: Coin.bitcoin)).thenAnswer(
|
||||||
|
(realInvocation) => NodeModel(
|
||||||
|
host: "127.0.0.1",
|
||||||
|
port: 2000,
|
||||||
|
name: "Stack Default",
|
||||||
|
id: "node id",
|
||||||
|
useSSL: true,
|
||||||
|
enabled: true,
|
||||||
|
coinName: "Bitcoin",
|
||||||
|
isFailover: false,
|
||||||
|
isDown: false));
|
||||||
|
|
||||||
|
await tester.pumpWidget(
|
||||||
|
ProviderScope(
|
||||||
|
overrides: [
|
||||||
|
walletsChangeNotifierProvider.overrideWithValue(mockWallets),
|
||||||
|
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
||||||
|
nodeServiceChangeNotifierProvider.overrideWithValue(mockNodeService)
|
||||||
|
],
|
||||||
|
child: MaterialApp(
|
||||||
|
theme: ThemeData(
|
||||||
|
extensions: [
|
||||||
|
StackColors.fromStackColorTheme(
|
||||||
|
LightColors(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
home: const NodeOptionsSheet(
|
||||||
|
nodeId: "node id", coin: Coin.bitcoin, popBackToRoute: ""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.text("Node options"), findsOneWidget);
|
||||||
|
expect(find.text("Stack Default"), findsOneWidget);
|
||||||
|
expect(find.text("Connected"), findsOneWidget);
|
||||||
|
expect(find.byType(SvgPicture), findsNWidgets(2));
|
||||||
|
expect(find.text("Details"), findsOneWidget);
|
||||||
|
expect(find.text("Connect"), findsOneWidget);
|
||||||
|
|
||||||
|
verify(mockNodeService.getPrimaryNodeFor(coin: Coin.bitcoin)).called(1);
|
||||||
|
verify(mockNodeService.getNodeById(id: "node id")).called(1);
|
||||||
|
verify(mockNodeService.addListener(any)).called(1);
|
||||||
|
verifyNoMoreInteractions(mockNodeService);
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets("Details tap", (tester) async {
|
||||||
|
final mockWallets = MockWallets();
|
||||||
|
final mockPrefs = MockPrefs();
|
||||||
|
final mockNodeService = MockNodeService();
|
||||||
|
final navigator = mockingjay.MockNavigator();
|
||||||
|
|
||||||
|
when(mockNodeService.getNodeById(id: "node id")).thenAnswer(
|
||||||
|
(realInvocation) => NodeModel(
|
||||||
|
host: "127.0.0.1",
|
||||||
|
port: 2000,
|
||||||
|
name: "Stack Default",
|
||||||
|
id: "node id",
|
||||||
|
useSSL: true,
|
||||||
|
enabled: true,
|
||||||
|
coinName: "Bitcoin",
|
||||||
|
isFailover: false,
|
||||||
|
isDown: false));
|
||||||
|
|
||||||
|
when(mockNodeService.getPrimaryNodeFor(coin: Coin.bitcoin)).thenAnswer(
|
||||||
|
(realInvocation) => NodeModel(
|
||||||
|
host: "127.0.0.1",
|
||||||
|
port: 2000,
|
||||||
|
name: "Stack Default",
|
||||||
|
id: "node id",
|
||||||
|
useSSL: true,
|
||||||
|
enabled: true,
|
||||||
|
coinName: "Bitcoin",
|
||||||
|
isFailover: false,
|
||||||
|
isDown: false));
|
||||||
|
|
||||||
|
mockingjay
|
||||||
|
.when(() => navigator.pushNamed("/nodeDetails",
|
||||||
|
arguments: const Tuple3(Coin.bitcoin, "node id", "coinNodes")))
|
||||||
|
.thenAnswer((_) async => {});
|
||||||
|
|
||||||
|
await tester.pumpWidget(
|
||||||
|
ProviderScope(
|
||||||
|
overrides: [
|
||||||
|
walletsChangeNotifierProvider.overrideWithValue(mockWallets),
|
||||||
|
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
||||||
|
nodeServiceChangeNotifierProvider.overrideWithValue(mockNodeService)
|
||||||
|
],
|
||||||
|
child: MaterialApp(
|
||||||
|
theme: ThemeData(
|
||||||
|
extensions: [
|
||||||
|
StackColors.fromStackColorTheme(LightColors()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
home: mockingjay.MockNavigatorProvider(
|
||||||
|
navigator: navigator,
|
||||||
|
child: const NodeOptionsSheet(
|
||||||
|
nodeId: "node id",
|
||||||
|
coin: Coin.bitcoin,
|
||||||
|
popBackToRoute: "coinNodes")),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
await tester.tap(find.text("Details"));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
mockingjay.verify(() => navigator.pop()).called(1);
|
||||||
|
mockingjay
|
||||||
|
.verify(() => navigator.pushNamed("/nodeDetails",
|
||||||
|
arguments: const Tuple3(Coin.bitcoin, "node id", "coinNodes")))
|
||||||
|
.called(1);
|
||||||
|
});
|
||||||
|
}
|
812
test/widget_tests/node_options_sheet_test.mocks.dart
Normal file
812
test/widget_tests/node_options_sheet_test.mocks.dart
Normal file
|
@ -0,0 +1,812 @@
|
||||||
|
// Mocks generated by Mockito 5.3.2 from annotations
|
||||||
|
// in stackwallet/test/widget_tests/node_options_sheet_test.dart.
|
||||||
|
// Do not manually edit this file.
|
||||||
|
|
||||||
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
|
import 'dart:async' as _i10;
|
||||||
|
import 'dart:ui' as _i12;
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart' as _i4;
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5;
|
||||||
|
import 'package:mockito/mockito.dart' as _i1;
|
||||||
|
import 'package:stackwallet/models/node_model.dart' as _i16;
|
||||||
|
import 'package:stackwallet/pages/exchange_view/sub_widgets/exchange_rate_sheet.dart'
|
||||||
|
as _i14;
|
||||||
|
import 'package:stackwallet/services/coins/manager.dart' as _i6;
|
||||||
|
import 'package:stackwallet/services/node_service.dart' as _i3;
|
||||||
|
import 'package:stackwallet/services/wallets.dart' as _i8;
|
||||||
|
import 'package:stackwallet/services/wallets_service.dart' as _i2;
|
||||||
|
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i15;
|
||||||
|
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i9;
|
||||||
|
import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i13;
|
||||||
|
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'
|
||||||
|
as _i7;
|
||||||
|
import 'package:stackwallet/utilities/prefs.dart' as _i11;
|
||||||
|
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: avoid_redundant_argument_values
|
||||||
|
// ignore_for_file: avoid_setters_without_getters
|
||||||
|
// ignore_for_file: comment_references
|
||||||
|
// ignore_for_file: implementation_imports
|
||||||
|
// ignore_for_file: invalid_use_of_visible_for_testing_member
|
||||||
|
// ignore_for_file: prefer_const_constructors
|
||||||
|
// ignore_for_file: unnecessary_parenthesis
|
||||||
|
// ignore_for_file: camel_case_types
|
||||||
|
// ignore_for_file: subtype_of_sealed_class
|
||||||
|
|
||||||
|
class _FakeWalletsService_0 extends _i1.SmartFake
|
||||||
|
implements _i2.WalletsService {
|
||||||
|
_FakeWalletsService_0(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeNodeService_1 extends _i1.SmartFake implements _i3.NodeService {
|
||||||
|
_FakeNodeService_1(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeChangeNotifierProvider_2<Notifier extends _i4.ChangeNotifier?>
|
||||||
|
extends _i1.SmartFake implements _i5.ChangeNotifierProvider<Notifier> {
|
||||||
|
_FakeChangeNotifierProvider_2(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeManager_3 extends _i1.SmartFake implements _i6.Manager {
|
||||||
|
_FakeManager_3(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FakeFlutterSecureStorageInterface_4 extends _i1.SmartFake
|
||||||
|
implements _i7.FlutterSecureStorageInterface {
|
||||||
|
_FakeFlutterSecureStorageInterface_4(
|
||||||
|
Object parent,
|
||||||
|
Invocation parentInvocation,
|
||||||
|
) : super(
|
||||||
|
parent,
|
||||||
|
parentInvocation,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A class which mocks [Wallets].
|
||||||
|
///
|
||||||
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
|
class MockWallets extends _i1.Mock implements _i8.Wallets {
|
||||||
|
MockWallets() {
|
||||||
|
_i1.throwOnMissingStub(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
_i2.WalletsService get walletsService => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#walletsService),
|
||||||
|
returnValue: _FakeWalletsService_0(
|
||||||
|
this,
|
||||||
|
Invocation.getter(#walletsService),
|
||||||
|
),
|
||||||
|
) as _i2.WalletsService);
|
||||||
|
@override
|
||||||
|
set walletsService(_i2.WalletsService? _walletsService) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#walletsService,
|
||||||
|
_walletsService,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
_i3.NodeService get nodeService => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#nodeService),
|
||||||
|
returnValue: _FakeNodeService_1(
|
||||||
|
this,
|
||||||
|
Invocation.getter(#nodeService),
|
||||||
|
),
|
||||||
|
) as _i3.NodeService);
|
||||||
|
@override
|
||||||
|
set nodeService(_i3.NodeService? _nodeService) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#nodeService,
|
||||||
|
_nodeService,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
bool get hasWallets => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#hasWallets),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
List<_i5.ChangeNotifierProvider<_i6.Manager>> get managerProviders =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.getter(#managerProviders),
|
||||||
|
returnValue: <_i5.ChangeNotifierProvider<_i6.Manager>>[],
|
||||||
|
) as List<_i5.ChangeNotifierProvider<_i6.Manager>>);
|
||||||
|
@override
|
||||||
|
List<_i6.Manager> get managers => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#managers),
|
||||||
|
returnValue: <_i6.Manager>[],
|
||||||
|
) as List<_i6.Manager>);
|
||||||
|
@override
|
||||||
|
bool get hasListeners => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#hasListeners),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
void dispose() => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#dispose,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
List<String> getWalletIdsFor({required _i9.Coin? coin}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#getWalletIdsFor,
|
||||||
|
[],
|
||||||
|
{#coin: coin},
|
||||||
|
),
|
||||||
|
returnValue: <String>[],
|
||||||
|
) as List<String>);
|
||||||
|
@override
|
||||||
|
Map<_i9.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>
|
||||||
|
getManagerProvidersByCoin() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#getManagerProvidersByCoin,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: <_i9.Coin,
|
||||||
|
List<_i5.ChangeNotifierProvider<_i6.Manager>>>{},
|
||||||
|
) as Map<_i9.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>);
|
||||||
|
@override
|
||||||
|
_i5.ChangeNotifierProvider<_i6.Manager> getManagerProvider(
|
||||||
|
String? walletId) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#getManagerProvider,
|
||||||
|
[walletId],
|
||||||
|
),
|
||||||
|
returnValue: _FakeChangeNotifierProvider_2<_i6.Manager>(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#getManagerProvider,
|
||||||
|
[walletId],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) as _i5.ChangeNotifierProvider<_i6.Manager>);
|
||||||
|
@override
|
||||||
|
_i6.Manager getManager(String? walletId) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#getManager,
|
||||||
|
[walletId],
|
||||||
|
),
|
||||||
|
returnValue: _FakeManager_3(
|
||||||
|
this,
|
||||||
|
Invocation.method(
|
||||||
|
#getManager,
|
||||||
|
[walletId],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) as _i6.Manager);
|
||||||
|
@override
|
||||||
|
void addWallet({
|
||||||
|
required String? walletId,
|
||||||
|
required _i6.Manager? manager,
|
||||||
|
}) =>
|
||||||
|
super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addWallet,
|
||||||
|
[],
|
||||||
|
{
|
||||||
|
#walletId: walletId,
|
||||||
|
#manager: manager,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void removeWallet({required String? walletId}) => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#removeWallet,
|
||||||
|
[],
|
||||||
|
{#walletId: walletId},
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
_i10.Future<void> load(_i11.Prefs? prefs) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#load,
|
||||||
|
[prefs],
|
||||||
|
),
|
||||||
|
returnValue: _i10.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i10.Future<void>.value(),
|
||||||
|
) as _i10.Future<void>);
|
||||||
|
@override
|
||||||
|
_i10.Future<void> loadAfterStackRestore(
|
||||||
|
_i11.Prefs? prefs,
|
||||||
|
List<_i6.Manager>? managers,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#loadAfterStackRestore,
|
||||||
|
[
|
||||||
|
prefs,
|
||||||
|
managers,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i10.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i10.Future<void>.value(),
|
||||||
|
) as _i10.Future<void>);
|
||||||
|
@override
|
||||||
|
void addListener(_i12.VoidCallback? listener) => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addListener,
|
||||||
|
[listener],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#removeListener,
|
||||||
|
[listener],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void notifyListeners() => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#notifyListeners,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A class which mocks [Prefs].
|
||||||
|
///
|
||||||
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
|
class MockPrefs extends _i1.Mock implements _i11.Prefs {
|
||||||
|
MockPrefs() {
|
||||||
|
_i1.throwOnMissingStub(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get isInitialized => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#isInitialized),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
int get lastUnlockedTimeout => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#lastUnlockedTimeout),
|
||||||
|
returnValue: 0,
|
||||||
|
) as int);
|
||||||
|
@override
|
||||||
|
set lastUnlockedTimeout(int? lastUnlockedTimeout) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#lastUnlockedTimeout,
|
||||||
|
lastUnlockedTimeout,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
int get lastUnlocked => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#lastUnlocked),
|
||||||
|
returnValue: 0,
|
||||||
|
) as int);
|
||||||
|
@override
|
||||||
|
set lastUnlocked(int? lastUnlocked) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#lastUnlocked,
|
||||||
|
lastUnlocked,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
int get currentNotificationId => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#currentNotificationId),
|
||||||
|
returnValue: 0,
|
||||||
|
) as int);
|
||||||
|
@override
|
||||||
|
List<String> get walletIdsSyncOnStartup => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#walletIdsSyncOnStartup),
|
||||||
|
returnValue: <String>[],
|
||||||
|
) as List<String>);
|
||||||
|
@override
|
||||||
|
set walletIdsSyncOnStartup(List<String>? walletIdsSyncOnStartup) =>
|
||||||
|
super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#walletIdsSyncOnStartup,
|
||||||
|
walletIdsSyncOnStartup,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
_i13.SyncingType get syncType => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#syncType),
|
||||||
|
returnValue: _i13.SyncingType.currentWalletOnly,
|
||||||
|
) as _i13.SyncingType);
|
||||||
|
@override
|
||||||
|
set syncType(_i13.SyncingType? syncType) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#syncType,
|
||||||
|
syncType,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
bool get wifiOnly => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#wifiOnly),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
set wifiOnly(bool? wifiOnly) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#wifiOnly,
|
||||||
|
wifiOnly,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
bool get showFavoriteWallets => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#showFavoriteWallets),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
set showFavoriteWallets(bool? showFavoriteWallets) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#showFavoriteWallets,
|
||||||
|
showFavoriteWallets,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
String get language => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#language),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
set language(String? newLanguage) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#language,
|
||||||
|
newLanguage,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
String get currency => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#currency),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
set currency(String? newCurrency) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#currency,
|
||||||
|
newCurrency,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
_i14.ExchangeRateType get exchangeRateType => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#exchangeRateType),
|
||||||
|
returnValue: _i14.ExchangeRateType.estimated,
|
||||||
|
) as _i14.ExchangeRateType);
|
||||||
|
@override
|
||||||
|
set exchangeRateType(_i14.ExchangeRateType? exchangeRateType) =>
|
||||||
|
super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#exchangeRateType,
|
||||||
|
exchangeRateType,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
bool get useBiometrics => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#useBiometrics),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
set useBiometrics(bool? useBiometrics) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#useBiometrics,
|
||||||
|
useBiometrics,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
bool get hasPin => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#hasPin),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
set hasPin(bool? hasPin) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#hasPin,
|
||||||
|
hasPin,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
bool get showTestNetCoins => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#showTestNetCoins),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
set showTestNetCoins(bool? showTestNetCoins) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#showTestNetCoins,
|
||||||
|
showTestNetCoins,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
bool get isAutoBackupEnabled => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#isAutoBackupEnabled),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
set isAutoBackupEnabled(bool? isAutoBackupEnabled) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#isAutoBackupEnabled,
|
||||||
|
isAutoBackupEnabled,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
set autoBackupLocation(String? autoBackupLocation) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#autoBackupLocation,
|
||||||
|
autoBackupLocation,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
_i15.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#backupFrequencyType),
|
||||||
|
returnValue: _i15.BackupFrequencyType.everyTenMinutes,
|
||||||
|
) as _i15.BackupFrequencyType);
|
||||||
|
@override
|
||||||
|
set backupFrequencyType(_i15.BackupFrequencyType? backupFrequencyType) =>
|
||||||
|
super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#backupFrequencyType,
|
||||||
|
backupFrequencyType,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
set lastAutoBackup(DateTime? lastAutoBackup) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#lastAutoBackup,
|
||||||
|
lastAutoBackup,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
bool get hideBlockExplorerWarning => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#hideBlockExplorerWarning),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
set hideBlockExplorerWarning(bool? hideBlockExplorerWarning) =>
|
||||||
|
super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#hideBlockExplorerWarning,
|
||||||
|
hideBlockExplorerWarning,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
bool get gotoWalletOnStartup => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#gotoWalletOnStartup),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
set gotoWalletOnStartup(bool? gotoWalletOnStartup) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#gotoWalletOnStartup,
|
||||||
|
gotoWalletOnStartup,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
set startupWalletId(String? startupWalletId) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#startupWalletId,
|
||||||
|
startupWalletId,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
bool get externalCalls => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#externalCalls),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
set externalCalls(bool? externalCalls) => super.noSuchMethod(
|
||||||
|
Invocation.setter(
|
||||||
|
#externalCalls,
|
||||||
|
externalCalls,
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
bool get hasListeners => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#hasListeners),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
_i10.Future<void> init() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#init,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i10.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i10.Future<void>.value(),
|
||||||
|
) as _i10.Future<void>);
|
||||||
|
@override
|
||||||
|
_i10.Future<void> incrementCurrentNotificationIndex() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#incrementCurrentNotificationIndex,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i10.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i10.Future<void>.value(),
|
||||||
|
) as _i10.Future<void>);
|
||||||
|
@override
|
||||||
|
void addListener(_i12.VoidCallback? listener) => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addListener,
|
||||||
|
[listener],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#removeListener,
|
||||||
|
[listener],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void dispose() => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#dispose,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void notifyListeners() => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#notifyListeners,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A class which mocks [NodeService].
|
||||||
|
///
|
||||||
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
|
class MockNodeService extends _i1.Mock implements _i3.NodeService {
|
||||||
|
MockNodeService() {
|
||||||
|
_i1.throwOnMissingStub(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
_i7.FlutterSecureStorageInterface get secureStorageInterface =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.getter(#secureStorageInterface),
|
||||||
|
returnValue: _FakeFlutterSecureStorageInterface_4(
|
||||||
|
this,
|
||||||
|
Invocation.getter(#secureStorageInterface),
|
||||||
|
),
|
||||||
|
) as _i7.FlutterSecureStorageInterface);
|
||||||
|
@override
|
||||||
|
List<_i16.NodeModel> get primaryNodes => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#primaryNodes),
|
||||||
|
returnValue: <_i16.NodeModel>[],
|
||||||
|
) as List<_i16.NodeModel>);
|
||||||
|
@override
|
||||||
|
List<_i16.NodeModel> get nodes => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#nodes),
|
||||||
|
returnValue: <_i16.NodeModel>[],
|
||||||
|
) as List<_i16.NodeModel>);
|
||||||
|
@override
|
||||||
|
bool get hasListeners => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#hasListeners),
|
||||||
|
returnValue: false,
|
||||||
|
) as bool);
|
||||||
|
@override
|
||||||
|
_i10.Future<void> updateDefaults() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#updateDefaults,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i10.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i10.Future<void>.value(),
|
||||||
|
) as _i10.Future<void>);
|
||||||
|
@override
|
||||||
|
_i10.Future<void> setPrimaryNodeFor({
|
||||||
|
required _i9.Coin? coin,
|
||||||
|
required _i16.NodeModel? node,
|
||||||
|
bool? shouldNotifyListeners = false,
|
||||||
|
}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#setPrimaryNodeFor,
|
||||||
|
[],
|
||||||
|
{
|
||||||
|
#coin: coin,
|
||||||
|
#node: node,
|
||||||
|
#shouldNotifyListeners: shouldNotifyListeners,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
returnValue: _i10.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i10.Future<void>.value(),
|
||||||
|
) as _i10.Future<void>);
|
||||||
|
@override
|
||||||
|
_i16.NodeModel? getPrimaryNodeFor({required _i9.Coin? coin}) =>
|
||||||
|
(super.noSuchMethod(Invocation.method(
|
||||||
|
#getPrimaryNodeFor,
|
||||||
|
[],
|
||||||
|
{#coin: coin},
|
||||||
|
)) as _i16.NodeModel?);
|
||||||
|
@override
|
||||||
|
List<_i16.NodeModel> getNodesFor(_i9.Coin? coin) => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#getNodesFor,
|
||||||
|
[coin],
|
||||||
|
),
|
||||||
|
returnValue: <_i16.NodeModel>[],
|
||||||
|
) as List<_i16.NodeModel>);
|
||||||
|
@override
|
||||||
|
_i16.NodeModel? getNodeById({required String? id}) =>
|
||||||
|
(super.noSuchMethod(Invocation.method(
|
||||||
|
#getNodeById,
|
||||||
|
[],
|
||||||
|
{#id: id},
|
||||||
|
)) as _i16.NodeModel?);
|
||||||
|
@override
|
||||||
|
List<_i16.NodeModel> failoverNodesFor({required _i9.Coin? coin}) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#failoverNodesFor,
|
||||||
|
[],
|
||||||
|
{#coin: coin},
|
||||||
|
),
|
||||||
|
returnValue: <_i16.NodeModel>[],
|
||||||
|
) as List<_i16.NodeModel>);
|
||||||
|
@override
|
||||||
|
_i10.Future<void> add(
|
||||||
|
_i16.NodeModel? node,
|
||||||
|
String? password,
|
||||||
|
bool? shouldNotifyListeners,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#add,
|
||||||
|
[
|
||||||
|
node,
|
||||||
|
password,
|
||||||
|
shouldNotifyListeners,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i10.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i10.Future<void>.value(),
|
||||||
|
) as _i10.Future<void>);
|
||||||
|
@override
|
||||||
|
_i10.Future<void> delete(
|
||||||
|
String? id,
|
||||||
|
bool? shouldNotifyListeners,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#delete,
|
||||||
|
[
|
||||||
|
id,
|
||||||
|
shouldNotifyListeners,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i10.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i10.Future<void>.value(),
|
||||||
|
) as _i10.Future<void>);
|
||||||
|
@override
|
||||||
|
_i10.Future<void> setEnabledState(
|
||||||
|
String? id,
|
||||||
|
bool? enabled,
|
||||||
|
bool? shouldNotifyListeners,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#setEnabledState,
|
||||||
|
[
|
||||||
|
id,
|
||||||
|
enabled,
|
||||||
|
shouldNotifyListeners,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i10.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i10.Future<void>.value(),
|
||||||
|
) as _i10.Future<void>);
|
||||||
|
@override
|
||||||
|
_i10.Future<void> edit(
|
||||||
|
_i16.NodeModel? editedNode,
|
||||||
|
String? password,
|
||||||
|
bool? shouldNotifyListeners,
|
||||||
|
) =>
|
||||||
|
(super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#edit,
|
||||||
|
[
|
||||||
|
editedNode,
|
||||||
|
password,
|
||||||
|
shouldNotifyListeners,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
returnValue: _i10.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i10.Future<void>.value(),
|
||||||
|
) as _i10.Future<void>);
|
||||||
|
@override
|
||||||
|
_i10.Future<void> updateCommunityNodes() => (super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#updateCommunityNodes,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValue: _i10.Future<void>.value(),
|
||||||
|
returnValueForMissingStub: _i10.Future<void>.value(),
|
||||||
|
) as _i10.Future<void>);
|
||||||
|
@override
|
||||||
|
void addListener(_i12.VoidCallback? listener) => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#addListener,
|
||||||
|
[listener],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#removeListener,
|
||||||
|
[listener],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void dispose() => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#dispose,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
void notifyListeners() => super.noSuchMethod(
|
||||||
|
Invocation.method(
|
||||||
|
#notifyListeners,
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
returnValueForMissingStub: null,
|
||||||
|
);
|
||||||
|
}
|
|
@ -2,27 +2,18 @@ import 'package:decimal/decimal.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:hive/hive.dart';
|
|
||||||
import 'package:hive_test/hive_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:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:stackwallet/hive/db.dart';
|
|
||||||
import 'package:stackwallet/models/models.dart';
|
import 'package:stackwallet/models/models.dart';
|
||||||
import 'package:stackwallet/models/node_model.dart';
|
|
||||||
import 'package:stackwallet/providers/providers.dart';
|
import 'package:stackwallet/providers/providers.dart';
|
||||||
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
|
|
||||||
import 'package:stackwallet/services/coins/coin_service.dart';
|
import 'package:stackwallet/services/coins/coin_service.dart';
|
||||||
import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
|
import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
|
||||||
// import 'package:mockito/mockito.dart';
|
|
||||||
// import 'package:stackwallet/models/models.dart';
|
|
||||||
import 'package:stackwallet/services/coins/manager.dart';
|
import 'package:stackwallet/services/coins/manager.dart';
|
||||||
import 'package:stackwallet/services/locale_service.dart';
|
import 'package:stackwallet/services/locale_service.dart';
|
||||||
import 'package:stackwallet/services/node_service.dart';
|
|
||||||
import 'package:stackwallet/services/notes_service.dart';
|
import 'package:stackwallet/services/notes_service.dart';
|
||||||
import 'package:stackwallet/services/price_service.dart';
|
import 'package:stackwallet/services/price_service.dart';
|
||||||
import 'package:stackwallet/services/transaction_notification_tracker.dart';
|
|
||||||
import 'package:stackwallet/services/wallets.dart';
|
import 'package:stackwallet/services/wallets.dart';
|
||||||
import 'package:stackwallet/utilities/default_nodes.dart';
|
import 'package:stackwallet/utilities/default_nodes.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
|
@ -111,7 +102,7 @@ void main() {
|
||||||
|
|
||||||
//
|
//
|
||||||
final title = find.text("Sent");
|
final title = find.text("Sent");
|
||||||
// final price1 = find.text("0.00");
|
// final price1 = find.text("0.00 USD");
|
||||||
final amount = find.text("1.00000000 FIRO");
|
final amount = find.text("1.00000000 FIRO");
|
||||||
|
|
||||||
final icon = find.byIcon(FeatherIcons.arrowUp);
|
final icon = find.byIcon(FeatherIcons.arrowUp);
|
||||||
|
@ -202,20 +193,12 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
final title = find.text("Receiving");
|
final title = find.text("Receiving");
|
||||||
// final price1 = find.text("0.00");
|
|
||||||
final amount = find.text("1.00000000 FIRO");
|
final amount = find.text("1.00000000 FIRO");
|
||||||
//
|
|
||||||
// final icon = find.byIcon(FeatherIcons.arrowDown);
|
|
||||||
//
|
|
||||||
expect(title, findsOneWidget);
|
expect(title, findsOneWidget);
|
||||||
// expect(price1, findsOneWidget);
|
|
||||||
expect(amount, findsOneWidget);
|
expect(amount, findsOneWidget);
|
||||||
// expect(icon, findsOneWidget);
|
|
||||||
//
|
|
||||||
await tester.pumpAndSettle(Duration(seconds: 2));
|
await tester.pumpAndSettle(Duration(seconds: 2));
|
||||||
//
|
|
||||||
// final price2 = find.text("\$10.00");
|
|
||||||
// expect(price2, findsOneWidget);
|
|
||||||
|
|
||||||
verify(mockLocaleService.addListener(any)).called(1);
|
verify(mockLocaleService.addListener(any)).called(1);
|
||||||
|
|
||||||
|
@ -229,89 +212,8 @@ void main() {
|
||||||
verifyNoMoreInteractions(mockLocaleService);
|
verifyNoMoreInteractions(mockLocaleService);
|
||||||
});
|
});
|
||||||
|
|
||||||
// testWidgets("bad tx displays correctly", (tester) async {
|
|
||||||
// final mockManager = MockManager();
|
|
||||||
// final mockNotesService = MockNotesService();
|
|
||||||
// final mockLocaleService = MockLocaleService();
|
|
||||||
//
|
|
||||||
// final tx = Transaction(
|
|
||||||
// txid: "some txid",
|
|
||||||
// confirmedStatus: false,
|
|
||||||
// timestamp: 1648595998,
|
|
||||||
// txType: "ahhhhhh",
|
|
||||||
// amount: 100000000,
|
|
||||||
// aliens: [],
|
|
||||||
// worthNow: "0.01",
|
|
||||||
// worthAtBlockTimestamp: "0.01",
|
|
||||||
// fees: 3794,
|
|
||||||
// inputSize: 1,
|
|
||||||
// outputSize: 1,
|
|
||||||
// inputs: [],
|
|
||||||
// outputs: [],
|
|
||||||
// address: "",
|
|
||||||
// height: null,
|
|
||||||
// subType: null,
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// when(mockManager.coinTicker).thenAnswer((_) => "FIRO");
|
|
||||||
// when(mockManager.fiatPrice).thenAnswer((_) async => Decimal.ten);
|
|
||||||
// when(mockManager.fiatCurrency).thenAnswer((_) => "USD");
|
|
||||||
//
|
|
||||||
// when(mockLocaleService.locale).thenAnswer((_) => "en_US");
|
|
||||||
//
|
|
||||||
// await tester.pumpWidget(
|
|
||||||
// MaterialApp(
|
|
||||||
// home: MultiProvider(
|
|
||||||
// providers: [
|
|
||||||
// ChangeNotifierProvider<NotesService>(
|
|
||||||
// create: (context) => mockNotesService,
|
|
||||||
// ),
|
|
||||||
// ChangeNotifierProvider<Manager>(
|
|
||||||
// create: (context) => mockManager,
|
|
||||||
// ),
|
|
||||||
// ChangeNotifierProvider<LocaleService>(
|
|
||||||
// create: (context) => mockLocaleService,
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// child: TransactionCard(transaction: tx),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// final title = find.text("Unknown");
|
|
||||||
// final price1 = find.text("0.00");
|
|
||||||
// final amount = find.text("1.00000000 FIRO");
|
|
||||||
//
|
|
||||||
// final icon = find.byIcon(Icons.warning_rounded);
|
|
||||||
//
|
|
||||||
// expect(title, findsOneWidget);
|
|
||||||
// expect(price1, findsOneWidget);
|
|
||||||
// expect(amount, findsOneWidget);
|
|
||||||
// expect(icon, findsOneWidget);
|
|
||||||
//
|
|
||||||
// await tester.pumpAndSettle(Duration(seconds: 2));
|
|
||||||
//
|
|
||||||
// final price2 = find.text("\$10.00");
|
|
||||||
// expect(price2, findsOneWidget);
|
|
||||||
//
|
|
||||||
// verify(mockManager.addListener(any)).called(1);
|
|
||||||
// verify(mockLocaleService.addListener(any)).called(1);
|
|
||||||
// verify(mockNotesService.addListener(any)).called(1);
|
|
||||||
//
|
|
||||||
// verify(mockManager.fiatCurrency).called(1);
|
|
||||||
// verify(mockManager.fiatPrice).called(1);
|
|
||||||
// verify(mockManager.coinTicker).called(1);
|
|
||||||
//
|
|
||||||
// verify(mockLocaleService.locale).called(2);
|
|
||||||
//
|
|
||||||
// verifyNoMoreInteractions(mockNotesService);
|
|
||||||
// verifyNoMoreInteractions(mockManager);
|
|
||||||
// verifyNoMoreInteractions(mockLocaleService);
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
testWidgets("Tap gesture", (tester) async {
|
testWidgets("Tap gesture", (tester) async {
|
||||||
final mockManager = MockManager();
|
final mockManager = MockManager();
|
||||||
final mockNotesService = MockNotesService();
|
|
||||||
final mockLocaleService = MockLocaleService();
|
final mockLocaleService = MockLocaleService();
|
||||||
final wallets = MockWallets();
|
final wallets = MockWallets();
|
||||||
final mockPrefs = MockPrefs();
|
final mockPrefs = MockPrefs();
|
||||||
|
@ -338,9 +240,6 @@ void main() {
|
||||||
confirmations: 10,
|
confirmations: 10,
|
||||||
);
|
);
|
||||||
|
|
||||||
when(mockNotesService.getNoteFor(txid: "some txid"))
|
|
||||||
.thenAnswer((_) async => "some note");
|
|
||||||
|
|
||||||
final CoinServiceAPI wallet = MockFiroWallet();
|
final CoinServiceAPI wallet = MockFiroWallet();
|
||||||
|
|
||||||
when(wallet.coin.ticker).thenAnswer((_) => "FIRO");
|
when(wallet.coin.ticker).thenAnswer((_) => "FIRO");
|
||||||
|
@ -386,28 +285,18 @@ void main() {
|
||||||
await tester.tap(find.byType(GestureDetector));
|
await tester.tap(find.byType(GestureDetector));
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
|
|
||||||
// verify(mockManager.addListener(any)).called(1);
|
|
||||||
verify(mockLocaleService.addListener(any)).called(1);
|
verify(mockLocaleService.addListener(any)).called(1);
|
||||||
// verify(mockNotesService.addListener(any)).called(1);
|
|
||||||
|
|
||||||
// verify(mockNotesService.getNoteFor(txid: "some txid")).called(1);
|
verify(mockPrefs.currency).called(1);
|
||||||
//
|
verify(mockLocaleService.locale).called(1);
|
||||||
// verify(mockManager.fiatCurrency).called(1);
|
verify(wallet.coin.ticker).called(1);
|
||||||
// verify(mockManager.fiatPrice).called(1);
|
|
||||||
// verify(mockManager.coinTicker).called(1);
|
|
||||||
//
|
|
||||||
// verify(mockLocaleService.locale).called(2);
|
|
||||||
//
|
|
||||||
// verifyNoMoreInteractions(mockNotesService);
|
|
||||||
// verifyNoMoreInteractions(mockManager);
|
|
||||||
// verifyNoMoreInteractions(mockLocaleService);
|
|
||||||
//
|
|
||||||
// mockingjay
|
|
||||||
// .verify(() => navigator.push(mockingjay.any(
|
|
||||||
// that:
|
|
||||||
// mockingjay.isRoute(whereName: equals("/transactionDetails"), whereArguments: equals(Tuple3(item1, item2, item3))))))
|
|
||||||
// .called(1);
|
|
||||||
|
|
||||||
// mockingjay.verifyNoMoreInteractions(navigator);
|
verifyNoMoreInteractions(wallet);
|
||||||
|
verifyNoMoreInteractions(mockLocaleService);
|
||||||
|
|
||||||
|
mockingjay
|
||||||
|
.verify(() => navigator.pushNamed("/transactionDetails",
|
||||||
|
arguments: Tuple3(tx, Coin.firo, "wallet id")))
|
||||||
|
.called(1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue