mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 01:37:54 +00:00
fix tests
This commit is contained in:
parent
26ce10c8ff
commit
4d537d88a3
10 changed files with 344 additions and 5 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
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_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
@ -7,6 +9,7 @@ import 'package:mockito/mockito.dart';
|
||||||
import 'package:stackwallet/models/isar/stack_theme.dart';
|
import 'package:stackwallet/models/isar/stack_theme.dart';
|
||||||
import 'package:stackwallet/models/notification_model.dart';
|
import 'package:stackwallet/models/notification_model.dart';
|
||||||
import 'package:stackwallet/notifications/notification_card.dart';
|
import 'package:stackwallet/notifications/notification_card.dart';
|
||||||
|
import 'package:stackwallet/themes/coin_icon_provider.dart';
|
||||||
import 'package:stackwallet/themes/stack_colors.dart';
|
import 'package:stackwallet/themes/stack_colors.dart';
|
||||||
import 'package:stackwallet/themes/theme_service.dart';
|
import 'package:stackwallet/themes/theme_service.dart';
|
||||||
import 'package:stackwallet/utilities/assets.dart';
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
|
@ -47,6 +50,10 @@ void main() {
|
||||||
ProviderScope(
|
ProviderScope(
|
||||||
overrides: [
|
overrides: [
|
||||||
pThemeService.overrideWithValue(mockThemeService),
|
pThemeService.overrideWithValue(mockThemeService),
|
||||||
|
coinIconProvider.overrideWithProvider(
|
||||||
|
(argument) => Provider<String>((_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg"),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
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';
|
||||||
|
@ -14,6 +16,7 @@ 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/themes/coin_icon_provider.dart';
|
||||||
import 'package:stackwallet/themes/stack_colors.dart';
|
import 'package:stackwallet/themes/stack_colors.dart';
|
||||||
import 'package:stackwallet/themes/theme_service.dart';
|
import 'package:stackwallet/themes/theme_service.dart';
|
||||||
import 'package:stackwallet/utilities/amount/amount_unit.dart';
|
import 'package:stackwallet/utilities/amount/amount_unit.dart';
|
||||||
|
@ -80,6 +83,10 @@ void main() {
|
||||||
.overrideWithValue(mockLocaleService),
|
.overrideWithValue(mockLocaleService),
|
||||||
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
||||||
pThemeService.overrideWithValue(mockThemeService),
|
pThemeService.overrideWithValue(mockThemeService),
|
||||||
|
coinIconProvider.overrideWithProvider(
|
||||||
|
(argument) => Provider<String>((_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg"),
|
||||||
|
),
|
||||||
// previewTxButtonStateProvider
|
// previewTxButtonStateProvider
|
||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
|
@ -157,7 +164,11 @@ void main() {
|
||||||
localeServiceChangeNotifierProvider
|
localeServiceChangeNotifierProvider
|
||||||
.overrideWithValue(mockLocaleService),
|
.overrideWithValue(mockLocaleService),
|
||||||
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
||||||
pThemeService.overrideWithValue(mockThemeService)
|
pThemeService.overrideWithValue(mockThemeService),
|
||||||
|
coinIconProvider.overrideWithProvider(
|
||||||
|
(argument) => Provider<String>((_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg"),
|
||||||
|
),
|
||||||
// previewTxButtonStateProvider
|
// previewTxButtonStateProvider
|
||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:decimal/decimal.dart';
|
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';
|
||||||
|
@ -14,6 +16,7 @@ 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/themes/coin_icon_provider.dart';
|
||||||
import 'package:stackwallet/themes/stack_colors.dart';
|
import 'package:stackwallet/themes/stack_colors.dart';
|
||||||
import 'package:stackwallet/themes/theme_service.dart';
|
import 'package:stackwallet/themes/theme_service.dart';
|
||||||
import 'package:stackwallet/utilities/amount/amount.dart';
|
import 'package:stackwallet/utilities/amount/amount.dart';
|
||||||
|
@ -89,6 +92,10 @@ void main() {
|
||||||
walletsChangeNotifierProvider.overrideWithValue(wallets),
|
walletsChangeNotifierProvider.overrideWithValue(wallets),
|
||||||
pThemeService.overrideWithValue(mockThemeService),
|
pThemeService.overrideWithValue(mockThemeService),
|
||||||
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
||||||
|
coinIconProvider.overrideWithProvider(
|
||||||
|
(argument) => Provider<String>((_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg"),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
@ -176,6 +183,10 @@ void main() {
|
||||||
walletsServiceChangeNotifierProvider
|
walletsServiceChangeNotifierProvider
|
||||||
.overrideWithValue(mockWalletsService),
|
.overrideWithValue(mockWalletsService),
|
||||||
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
||||||
|
coinIconProvider.overrideWithProvider(
|
||||||
|
(argument) => Provider<String>((_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg"),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
@ -261,7 +272,11 @@ void main() {
|
||||||
pThemeService.overrideWithValue(mockThemeService),
|
pThemeService.overrideWithValue(mockThemeService),
|
||||||
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
||||||
walletsServiceChangeNotifierProvider
|
walletsServiceChangeNotifierProvider
|
||||||
.overrideWithValue(mockWalletsService)
|
.overrideWithValue(mockWalletsService),
|
||||||
|
coinIconProvider.overrideWithProvider(
|
||||||
|
(argument) => Provider<String>((_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg"),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
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';
|
||||||
|
@ -12,6 +14,7 @@ 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/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/themes/coin_icon_provider.dart';
|
||||||
import 'package:stackwallet/themes/stack_colors.dart';
|
import 'package:stackwallet/themes/stack_colors.dart';
|
||||||
import 'package:stackwallet/themes/theme_service.dart';
|
import 'package:stackwallet/themes/theme_service.dart';
|
||||||
import 'package:stackwallet/utilities/amount/amount.dart';
|
import 'package:stackwallet/utilities/amount/amount.dart';
|
||||||
|
@ -72,6 +75,10 @@ void main() {
|
||||||
overrides: [
|
overrides: [
|
||||||
walletsChangeNotifierProvider.overrideWithValue(mockWallet),
|
walletsChangeNotifierProvider.overrideWithValue(mockWallet),
|
||||||
pThemeService.overrideWithValue(mockThemeService),
|
pThemeService.overrideWithValue(mockThemeService),
|
||||||
|
coinIconProvider.overrideWithProvider(
|
||||||
|
(argument) => Provider<String>((_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg"),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
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';
|
||||||
|
@ -5,7 +7,9 @@ import 'package:mockito/annotations.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:stackwallet/models/exchange/response_objects/trade.dart';
|
import 'package:stackwallet/models/exchange/response_objects/trade.dart';
|
||||||
import 'package:stackwallet/models/isar/stack_theme.dart';
|
import 'package:stackwallet/models/isar/stack_theme.dart';
|
||||||
|
import 'package:stackwallet/themes/coin_icon_provider.dart';
|
||||||
import 'package:stackwallet/themes/stack_colors.dart';
|
import 'package:stackwallet/themes/stack_colors.dart';
|
||||||
|
import 'package:stackwallet/themes/theme_providers.dart';
|
||||||
import 'package:stackwallet/themes/theme_service.dart';
|
import 'package:stackwallet/themes/theme_service.dart';
|
||||||
import 'package:stackwallet/widgets/trade_card.dart';
|
import 'package:stackwallet/widgets/trade_card.dart';
|
||||||
|
|
||||||
|
@ -14,10 +18,17 @@ import 'trade_card_test.mocks.dart';
|
||||||
|
|
||||||
@GenerateMocks([
|
@GenerateMocks([
|
||||||
ThemeService,
|
ThemeService,
|
||||||
|
IThemeAssets,
|
||||||
])
|
])
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets("Test Trade card builds", (widgetTester) async {
|
testWidgets("Test Trade card builds", (widgetTester) async {
|
||||||
final mockThemeService = MockThemeService();
|
final mockThemeService = MockThemeService();
|
||||||
|
final mockIThemeAssets = MockIThemeAssets();
|
||||||
|
|
||||||
|
when(mockIThemeAssets.txExchangeFailed).thenAnswer(
|
||||||
|
(_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg",
|
||||||
|
);
|
||||||
when(mockThemeService.getTheme(themeId: "light")).thenAnswer(
|
when(mockThemeService.getTheme(themeId: "light")).thenAnswer(
|
||||||
(_) => StackTheme.fromJson(
|
(_) => StackTheme.fromJson(
|
||||||
json: lightThemeJsonMap,
|
json: lightThemeJsonMap,
|
||||||
|
@ -51,6 +62,15 @@ void main() {
|
||||||
ProviderScope(
|
ProviderScope(
|
||||||
overrides: [
|
overrides: [
|
||||||
pThemeService.overrideWithValue(mockThemeService),
|
pThemeService.overrideWithValue(mockThemeService),
|
||||||
|
themeAssetsProvider.overrideWithProvider(
|
||||||
|
StateProvider(
|
||||||
|
(ref) => mockIThemeAssets,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
coinIconProvider.overrideWithProvider(
|
||||||
|
(argument) => Provider<String>((_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg"),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
|
|
@ -129,3 +129,103 @@ class MockThemeService extends _i1.Mock implements _i3.ThemeService {
|
||||||
{#themeId: themeId},
|
{#themeId: themeId},
|
||||||
)) as _i4.StackTheme?);
|
)) as _i4.StackTheme?);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A class which mocks [IThemeAssets].
|
||||||
|
///
|
||||||
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
|
class MockIThemeAssets extends _i1.Mock implements _i4.IThemeAssets {
|
||||||
|
MockIThemeAssets() {
|
||||||
|
_i1.throwOnMissingStub(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get bellNew => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#bellNew),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get buy => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#buy),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get exchange => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#exchange),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get personaIncognito => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#personaIncognito),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get personaEasy => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#personaEasy),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get stack => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#stack),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get stackIcon => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#stackIcon),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get receive => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#receive),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get receivePending => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#receivePending),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get receiveCancelled => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#receiveCancelled),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get send => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#send),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get sendPending => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#sendPending),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get sendCancelled => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#sendCancelled),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get themeSelector => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#themeSelector),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get themePreview => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#themePreview),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get txExchange => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#txExchange),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get txExchangePending => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#txExchangePending),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get txExchangeFailed => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#txExchangeFailed),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:decimal/decimal.dart';
|
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';
|
||||||
|
@ -22,7 +24,9 @@ import 'package:stackwallet/services/locale_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/wallets.dart';
|
import 'package:stackwallet/services/wallets.dart';
|
||||||
|
import 'package:stackwallet/themes/coin_icon_provider.dart';
|
||||||
import 'package:stackwallet/themes/stack_colors.dart';
|
import 'package:stackwallet/themes/stack_colors.dart';
|
||||||
|
import 'package:stackwallet/themes/theme_providers.dart';
|
||||||
import 'package:stackwallet/themes/theme_service.dart';
|
import 'package:stackwallet/themes/theme_service.dart';
|
||||||
import 'package:stackwallet/utilities/amount/amount.dart';
|
import 'package:stackwallet/utilities/amount/amount.dart';
|
||||||
import 'package:stackwallet/utilities/amount/amount_unit.dart';
|
import 'package:stackwallet/utilities/amount/amount_unit.dart';
|
||||||
|
@ -46,6 +50,7 @@ import 'transaction_card_test.mocks.dart';
|
||||||
NotesService,
|
NotesService,
|
||||||
ThemeService,
|
ThemeService,
|
||||||
MainDB,
|
MainDB,
|
||||||
|
IThemeAssets,
|
||||||
], customMocks: [])
|
], customMocks: [])
|
||||||
void main() {
|
void main() {
|
||||||
TestWidgetsFlutterBinding.ensureInitialized();
|
TestWidgetsFlutterBinding.ensureInitialized();
|
||||||
|
@ -57,6 +62,12 @@ void main() {
|
||||||
final mockPriceService = MockPriceService();
|
final mockPriceService = MockPriceService();
|
||||||
final mockThemeService = MockThemeService();
|
final mockThemeService = MockThemeService();
|
||||||
final mockDB = MockMainDB();
|
final mockDB = MockMainDB();
|
||||||
|
final mockIThemeAssets = MockIThemeAssets();
|
||||||
|
|
||||||
|
when(mockIThemeAssets.send).thenAnswer(
|
||||||
|
(_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg",
|
||||||
|
);
|
||||||
|
|
||||||
final tx = Transaction(
|
final tx = Transaction(
|
||||||
txid: "some txid",
|
txid: "some txid",
|
||||||
|
@ -130,6 +141,15 @@ void main() {
|
||||||
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
||||||
priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService),
|
priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService),
|
||||||
mainDBProvider.overrideWithValue(mockDB),
|
mainDBProvider.overrideWithValue(mockDB),
|
||||||
|
coinIconProvider.overrideWithProvider(
|
||||||
|
(argument) => Provider<String>((_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg"),
|
||||||
|
),
|
||||||
|
themeAssetsProvider.overrideWithProvider(
|
||||||
|
StateProvider(
|
||||||
|
(ref) => mockIThemeAssets,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
@ -186,6 +206,12 @@ void main() {
|
||||||
final mockPriceService = MockPriceService();
|
final mockPriceService = MockPriceService();
|
||||||
final mockThemeService = MockThemeService();
|
final mockThemeService = MockThemeService();
|
||||||
final mockDB = MockMainDB();
|
final mockDB = MockMainDB();
|
||||||
|
final mockIThemeAssets = MockIThemeAssets();
|
||||||
|
|
||||||
|
when(mockIThemeAssets.txExchangeFailed).thenAnswer(
|
||||||
|
(_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg",
|
||||||
|
);
|
||||||
|
|
||||||
final tx = Transaction(
|
final tx = Transaction(
|
||||||
txid: "some txid",
|
txid: "some txid",
|
||||||
|
@ -257,7 +283,16 @@ void main() {
|
||||||
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
||||||
pThemeService.overrideWithValue(mockThemeService),
|
pThemeService.overrideWithValue(mockThemeService),
|
||||||
mainDBProvider.overrideWithValue(mockDB),
|
mainDBProvider.overrideWithValue(mockDB),
|
||||||
priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService)
|
priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService),
|
||||||
|
coinIconProvider.overrideWithProvider(
|
||||||
|
(argument) => Provider<String>((_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg"),
|
||||||
|
),
|
||||||
|
themeAssetsProvider.overrideWithProvider(
|
||||||
|
StateProvider(
|
||||||
|
(ref) => mockIThemeAssets,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
@ -312,6 +347,12 @@ void main() {
|
||||||
final mockPriceService = MockPriceService();
|
final mockPriceService = MockPriceService();
|
||||||
final mockThemeService = MockThemeService();
|
final mockThemeService = MockThemeService();
|
||||||
final mockDB = MockMainDB();
|
final mockDB = MockMainDB();
|
||||||
|
final mockIThemeAssets = MockIThemeAssets();
|
||||||
|
|
||||||
|
when(mockIThemeAssets.receive).thenAnswer(
|
||||||
|
(_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg",
|
||||||
|
);
|
||||||
|
|
||||||
final tx = Transaction(
|
final tx = Transaction(
|
||||||
txid: "some txid",
|
txid: "some txid",
|
||||||
|
@ -384,7 +425,16 @@ void main() {
|
||||||
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
||||||
pThemeService.overrideWithValue(mockThemeService),
|
pThemeService.overrideWithValue(mockThemeService),
|
||||||
mainDBProvider.overrideWithValue(mockDB),
|
mainDBProvider.overrideWithValue(mockDB),
|
||||||
priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService)
|
priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService),
|
||||||
|
coinIconProvider.overrideWithProvider(
|
||||||
|
(argument) => Provider<String>((_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg"),
|
||||||
|
),
|
||||||
|
themeAssetsProvider.overrideWithProvider(
|
||||||
|
StateProvider(
|
||||||
|
(ref) => mockIThemeAssets,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
@ -432,6 +482,12 @@ void main() {
|
||||||
final mockThemeService = MockThemeService();
|
final mockThemeService = MockThemeService();
|
||||||
final mockDB = MockMainDB();
|
final mockDB = MockMainDB();
|
||||||
final navigator = mockingjay.MockNavigator();
|
final navigator = mockingjay.MockNavigator();
|
||||||
|
final mockIThemeAssets = MockIThemeAssets();
|
||||||
|
|
||||||
|
when(mockIThemeAssets.send).thenAnswer(
|
||||||
|
(_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg",
|
||||||
|
);
|
||||||
|
|
||||||
final tx = Transaction(
|
final tx = Transaction(
|
||||||
txid: "some txid",
|
txid: "some txid",
|
||||||
|
@ -509,7 +565,16 @@ void main() {
|
||||||
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
||||||
pThemeService.overrideWithValue(mockThemeService),
|
pThemeService.overrideWithValue(mockThemeService),
|
||||||
mainDBProvider.overrideWithValue(mockDB),
|
mainDBProvider.overrideWithValue(mockDB),
|
||||||
priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService)
|
priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService),
|
||||||
|
coinIconProvider.overrideWithProvider(
|
||||||
|
(argument) => Provider<String>((_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg"),
|
||||||
|
),
|
||||||
|
themeAssetsProvider.overrideWithProvider(
|
||||||
|
StateProvider(
|
||||||
|
(ref) => mockIThemeAssets,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
|
|
@ -3538,3 +3538,103 @@ class MockMainDB extends _i1.Mock implements _i14.MainDB {
|
||||||
returnValue: _i19.Future<int?>.value(),
|
returnValue: _i19.Future<int?>.value(),
|
||||||
) as _i19.Future<int?>);
|
) as _i19.Future<int?>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A class which mocks [IThemeAssets].
|
||||||
|
///
|
||||||
|
/// See the documentation for Mockito's code generation for more information.
|
||||||
|
class MockIThemeAssets extends _i1.Mock implements _i33.IThemeAssets {
|
||||||
|
MockIThemeAssets() {
|
||||||
|
_i1.throwOnMissingStub(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get bellNew => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#bellNew),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get buy => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#buy),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get exchange => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#exchange),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get personaIncognito => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#personaIncognito),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get personaEasy => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#personaEasy),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get stack => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#stack),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get stackIcon => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#stackIcon),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get receive => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#receive),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get receivePending => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#receivePending),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get receiveCancelled => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#receiveCancelled),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get send => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#send),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get sendPending => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#sendPending),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get sendCancelled => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#sendCancelled),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get themeSelector => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#themeSelector),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get themePreview => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#themePreview),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get txExchange => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#txExchange),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get txExchangePending => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#txExchangePending),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
@override
|
||||||
|
String get txExchangeFailed => (super.noSuchMethod(
|
||||||
|
Invocation.getter(#txExchangeFailed),
|
||||||
|
returnValue: '',
|
||||||
|
) as String);
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:decimal/decimal.dart';
|
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';
|
||||||
|
@ -12,6 +14,7 @@ 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/locale_service.dart';
|
||||||
import 'package:stackwallet/services/wallets.dart';
|
import 'package:stackwallet/services/wallets.dart';
|
||||||
|
import 'package:stackwallet/themes/coin_icon_provider.dart';
|
||||||
import 'package:stackwallet/themes/stack_colors.dart';
|
import 'package:stackwallet/themes/stack_colors.dart';
|
||||||
import 'package:stackwallet/themes/theme_service.dart';
|
import 'package:stackwallet/themes/theme_service.dart';
|
||||||
import 'package:stackwallet/utilities/amount/amount.dart';
|
import 'package:stackwallet/utilities/amount/amount.dart';
|
||||||
|
@ -73,6 +76,10 @@ void main() {
|
||||||
overrides: [
|
overrides: [
|
||||||
walletsChangeNotifierProvider.overrideWithValue(wallets),
|
walletsChangeNotifierProvider.overrideWithValue(wallets),
|
||||||
pThemeService.overrideWithValue(mockThemeService),
|
pThemeService.overrideWithValue(mockThemeService),
|
||||||
|
coinIconProvider.overrideWithProvider(
|
||||||
|
(argument) => Provider<String>((_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg"),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
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';
|
||||||
|
@ -12,6 +14,7 @@ import 'package:stackwallet/services/coins/manager.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/themes/coin_icon_provider.dart';
|
||||||
import 'package:stackwallet/themes/stack_colors.dart';
|
import 'package:stackwallet/themes/stack_colors.dart';
|
||||||
import 'package:stackwallet/themes/theme_service.dart';
|
import 'package:stackwallet/themes/theme_service.dart';
|
||||||
import 'package:stackwallet/utilities/amount/amount.dart';
|
import 'package:stackwallet/utilities/amount/amount.dart';
|
||||||
|
@ -65,6 +68,10 @@ void main() {
|
||||||
overrides: [
|
overrides: [
|
||||||
walletsChangeNotifierProvider.overrideWithValue(wallets),
|
walletsChangeNotifierProvider.overrideWithValue(wallets),
|
||||||
pThemeService.overrideWithValue(mockThemeService),
|
pThemeService.overrideWithValue(mockThemeService),
|
||||||
|
coinIconProvider.overrideWithProvider(
|
||||||
|
(argument) => Provider<String>((_) =>
|
||||||
|
"${Directory.current.path}/test/sample_data/light/assets/dummy.svg"),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
|
Loading…
Reference in a new issue