fix price test and update mocks

This commit is contained in:
julian 2023-09-13 10:58:02 -06:00
parent 4b518243c6
commit 6214688768
19 changed files with 4335 additions and 4166 deletions

View file

@ -33,8 +33,7 @@ class PriceAPI {
static const Duration refreshIntervalDuration = static const Duration refreshIntervalDuration =
Duration(seconds: refreshInterval); Duration(seconds: refreshInterval);
// final Client client; final HTTP client;
HTTP client = HTTP();
PriceAPI(this.client); PriceAPI(this.client);

View file

@ -582,14 +582,14 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
bool get torKillswitch => (super.noSuchMethod( bool get torKillSwitch => (super.noSuchMethod(
Invocation.getter(#torKillswitch), Invocation.getter(#torKillSwitch),
returnValue: false, returnValue: false,
) as bool); ) as bool);
@override @override
set torKillswitch(bool? torKillswitch) => super.noSuchMethod( set torKillSwitch(bool? torKillswitch) => super.noSuchMethod(
Invocation.setter( Invocation.setter(
#torKillswitch, #torKillSwitch,
torKillswitch, torKillswitch,
), ),
returnValueForMissingStub: null, returnValueForMissingStub: null,

View file

@ -1524,7 +1524,7 @@ void main() {
final mockPrefs = MockPrefs(); final mockPrefs = MockPrefs();
when(mockPrefs.useTor).thenAnswer((_) => false); when(mockPrefs.useTor).thenAnswer((_) => false);
when(mockPrefs.torKillswitch) when(mockPrefs.torKillSwitch)
.thenAnswer((_) => false); // Or true, shouldn't matter. .thenAnswer((_) => false); // Or true, shouldn't matter.
when(mockPrefs.wifiOnly).thenAnswer((_) => false); when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final mockTorService = MockTorService(); final mockTorService = MockTorService();
@ -1549,7 +1549,7 @@ void main() {
verify(mockPrefs.wifiOnly).called(1); verify(mockPrefs.wifiOnly).called(1);
verify(mockPrefs.useTor).called(1); verify(mockPrefs.useTor).called(1);
verifyNever(mockPrefs.torKillswitch); verifyNever(mockPrefs.torKillSwitch);
verifyNoMoreInteractions(mockPrefs); verifyNoMoreInteractions(mockPrefs);
verifyNever(mockTorService.enabled); verifyNever(mockTorService.enabled);
verifyNoMoreInteractions(mockTorService); verifyNoMoreInteractions(mockTorService);
@ -1571,7 +1571,7 @@ void main() {
final mockPrefs = MockPrefs(); final mockPrefs = MockPrefs();
when(mockPrefs.useTor).thenAnswer((_) => true); when(mockPrefs.useTor).thenAnswer((_) => true);
when(mockPrefs.torKillswitch).thenAnswer((_) => false); when(mockPrefs.torKillSwitch).thenAnswer((_) => false);
when(mockPrefs.wifiOnly).thenAnswer((_) => false); when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final mockTorService = MockTorService(); final mockTorService = MockTorService();
@ -1599,7 +1599,7 @@ void main() {
verify(mockPrefs.wifiOnly).called(1); verify(mockPrefs.wifiOnly).called(1);
verify(mockPrefs.useTor).called(1); verify(mockPrefs.useTor).called(1);
verify(mockPrefs.torKillswitch).called(1); verify(mockPrefs.torKillSwitch).called(1);
verifyNoMoreInteractions(mockPrefs); verifyNoMoreInteractions(mockPrefs);
verify(mockTorService.enabled).called(1); verify(mockTorService.enabled).called(1);
verifyNever(mockTorService.proxyInfo); verifyNever(mockTorService.proxyInfo);
@ -1624,7 +1624,7 @@ void main() {
final mockPrefs = MockPrefs(); final mockPrefs = MockPrefs();
when(mockPrefs.useTor).thenAnswer((_) => true); when(mockPrefs.useTor).thenAnswer((_) => true);
when(mockPrefs.torKillswitch).thenAnswer((_) => false); // Or true. when(mockPrefs.torKillSwitch).thenAnswer((_) => false); // Or true.
when(mockPrefs.wifiOnly).thenAnswer((_) => false); when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final mockTorService = MockTorService(); final mockTorService = MockTorService();
@ -1651,7 +1651,7 @@ void main() {
verify(mockClient.proxyInfo).called(1); verify(mockClient.proxyInfo).called(1);
verify(mockPrefs.wifiOnly).called(1); verify(mockPrefs.wifiOnly).called(1);
verify(mockPrefs.useTor).called(1); verify(mockPrefs.useTor).called(1);
verifyNever(mockPrefs.torKillswitch); verifyNever(mockPrefs.torKillSwitch);
verifyNoMoreInteractions(mockPrefs); verifyNoMoreInteractions(mockPrefs);
verify(mockTorService.enabled).called(1); verify(mockTorService.enabled).called(1);
verify(mockTorService.proxyInfo).called(1); verify(mockTorService.proxyInfo).called(1);
@ -1682,7 +1682,7 @@ void main() {
final mockPrefs = MockPrefs(); final mockPrefs = MockPrefs();
when(mockPrefs.useTor).thenAnswer((_) => true); when(mockPrefs.useTor).thenAnswer((_) => true);
when(mockPrefs.torKillswitch).thenAnswer((_) => true); when(mockPrefs.torKillSwitch).thenAnswer((_) => true);
when(mockPrefs.wifiOnly).thenAnswer((_) => false); when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final mockTorService = MockTorService(); final mockTorService = MockTorService();
when(mockTorService.enabled).thenAnswer((_) => false); when(mockTorService.enabled).thenAnswer((_) => false);
@ -1710,7 +1710,7 @@ void main() {
verify(mockPrefs.wifiOnly).called(1); verify(mockPrefs.wifiOnly).called(1);
verify(mockPrefs.useTor).called(1); verify(mockPrefs.useTor).called(1);
verify(mockPrefs.torKillswitch).called(1); verify(mockPrefs.torKillSwitch).called(1);
verifyNoMoreInteractions(mockPrefs); verifyNoMoreInteractions(mockPrefs);
verify(mockTorService.enabled).called(1); verify(mockTorService.enabled).called(1);
verifyNoMoreInteractions(mockTorService); verifyNoMoreInteractions(mockTorService);
@ -1737,7 +1737,7 @@ void main() {
final mockPrefs = MockPrefs(); final mockPrefs = MockPrefs();
when(mockPrefs.useTor).thenAnswer((_) => true); when(mockPrefs.useTor).thenAnswer((_) => true);
when(mockPrefs.torKillswitch).thenAnswer((_) => false); when(mockPrefs.torKillSwitch).thenAnswer((_) => false);
when(mockPrefs.wifiOnly).thenAnswer((_) => false); when(mockPrefs.wifiOnly).thenAnswer((_) => false);
final mockTorService = MockTorService(); final mockTorService = MockTorService();
when(mockTorService.enabled).thenAnswer((_) => false); when(mockTorService.enabled).thenAnswer((_) => false);
@ -1761,7 +1761,7 @@ void main() {
verify(mockPrefs.wifiOnly).called(1); verify(mockPrefs.wifiOnly).called(1);
verify(mockPrefs.useTor).called(1); verify(mockPrefs.useTor).called(1);
verify(mockPrefs.torKillswitch).called(1); verify(mockPrefs.torKillSwitch).called(1);
verifyNoMoreInteractions(mockPrefs); verifyNoMoreInteractions(mockPrefs);
verify(mockTorService.enabled).called(1); verify(mockTorService.enabled).called(1);
verifyNoMoreInteractions(mockTorService); verifyNoMoreInteractions(mockTorService);

View file

@ -15,6 +15,7 @@ import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i7;
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i9; import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i9;
import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i6; import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i6;
import 'package:stackwallet/utilities/prefs.dart' as _i5; import 'package:stackwallet/utilities/prefs.dart' as _i5;
import 'package:tor_ffi_plugin/tor_ffi_plugin.dart' as _i12;
// ignore_for_file: type=lint // ignore_for_file: type=lint
// ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_redundant_argument_values
@ -321,14 +322,14 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
bool get torKillswitch => (super.noSuchMethod( bool get torKillSwitch => (super.noSuchMethod(
Invocation.getter(#torKillswitch), Invocation.getter(#torKillSwitch),
returnValue: false, returnValue: false,
) as bool); ) as bool);
@override @override
set torKillswitch(bool? torKillswitch) => super.noSuchMethod( set torKillSwitch(bool? torKillswitch) => super.noSuchMethod(
Invocation.setter( Invocation.setter(
#torKillswitch, #torKillSwitch,
torKillswitch, torKillswitch,
), ),
returnValueForMissingStub: null, returnValueForMissingStub: null,
@ -674,6 +675,15 @@ class MockTorService extends _i1.Mock implements _i11.TorService {
), ),
) as ({_i3.InternetAddress host, int port})); ) as ({_i3.InternetAddress host, int port}));
@override @override
void init({_i12.Tor? mockableOverride}) => super.noSuchMethod(
Invocation.method(
#init,
[],
{#mockableOverride: mockableOverride},
),
returnValueForMissingStub: null,
);
@override
_i4.Future<void> start() => (super.noSuchMethod( _i4.Future<void> start() => (super.noSuchMethod(
Invocation.method( Invocation.method(
#start, #start,

View file

@ -3,13 +3,14 @@
// Do not manually edit this file. // Do not manually edit this file.
// ignore_for_file: no_leading_underscores_for_library_prefixes // ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:async' as _i5; import 'dart:async' as _i6;
import 'dart:typed_data' as _i6; import 'dart:typed_data' as _i7;
import 'package:mockito/mockito.dart' as _i1; import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/db/isar/main_db.dart' as _i2; import 'package:stackwallet/db/isar/main_db.dart' as _i3;
import 'package:stackwallet/models/isar/stack_theme.dart' as _i4; import 'package:stackwallet/models/isar/stack_theme.dart' as _i5;
import 'package:stackwallet/themes/theme_service.dart' as _i3; import 'package:stackwallet/networking/http.dart' as _i2;
import 'package:stackwallet/themes/theme_service.dart' as _i4;
// ignore_for_file: type=lint // ignore_for_file: type=lint
// ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_redundant_argument_values
@ -22,8 +23,18 @@ import 'package:stackwallet/themes/theme_service.dart' as _i3;
// ignore_for_file: camel_case_types // ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class // ignore_for_file: subtype_of_sealed_class
class _FakeMainDB_0 extends _i1.SmartFake implements _i2.MainDB { class _FakeHTTP_0 extends _i1.SmartFake implements _i2.HTTP {
_FakeMainDB_0( _FakeHTTP_0(
Object parent,
Invocation parentInvocation,
) : super(
parent,
parentInvocation,
);
}
class _FakeMainDB_1 extends _i1.SmartFake implements _i3.MainDB {
_FakeMainDB_1(
Object parent, Object parent,
Invocation parentInvocation, Invocation parentInvocation,
) : super( ) : super(
@ -35,26 +46,42 @@ class _FakeMainDB_0 extends _i1.SmartFake implements _i2.MainDB {
/// A class which mocks [ThemeService]. /// A class which mocks [ThemeService].
/// ///
/// See the documentation for Mockito's code generation for more information. /// See the documentation for Mockito's code generation for more information.
class MockThemeService extends _i1.Mock implements _i3.ThemeService { class MockThemeService extends _i1.Mock implements _i4.ThemeService {
MockThemeService() { MockThemeService() {
_i1.throwOnMissingStub(this); _i1.throwOnMissingStub(this);
} }
@override @override
_i2.MainDB get db => (super.noSuchMethod( _i2.HTTP get client => (super.noSuchMethod(
Invocation.getter(#client),
returnValue: _FakeHTTP_0(
this,
Invocation.getter(#client),
),
) as _i2.HTTP);
@override
set client(_i2.HTTP? _client) => super.noSuchMethod(
Invocation.setter(
#client,
_client,
),
returnValueForMissingStub: null,
);
@override
_i3.MainDB get db => (super.noSuchMethod(
Invocation.getter(#db), Invocation.getter(#db),
returnValue: _FakeMainDB_0( returnValue: _FakeMainDB_1(
this, this,
Invocation.getter(#db), Invocation.getter(#db),
), ),
) as _i2.MainDB); ) as _i3.MainDB);
@override @override
List<_i4.StackTheme> get installedThemes => (super.noSuchMethod( List<_i5.StackTheme> get installedThemes => (super.noSuchMethod(
Invocation.getter(#installedThemes), Invocation.getter(#installedThemes),
returnValue: <_i4.StackTheme>[], returnValue: <_i5.StackTheme>[],
) as List<_i4.StackTheme>); ) as List<_i5.StackTheme>);
@override @override
void init(_i2.MainDB? db) => super.noSuchMethod( void init(_i3.MainDB? db) => super.noSuchMethod(
Invocation.method( Invocation.method(
#init, #init,
[db], [db],
@ -62,70 +89,70 @@ class MockThemeService extends _i1.Mock implements _i3.ThemeService {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
_i5.Future<void> install({required _i6.Uint8List? themeArchiveData}) => _i6.Future<void> install({required _i7.Uint8List? themeArchiveData}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#install, #install,
[], [],
{#themeArchiveData: themeArchiveData}, {#themeArchiveData: themeArchiveData},
), ),
returnValue: _i5.Future<void>.value(), returnValue: _i6.Future<void>.value(),
returnValueForMissingStub: _i5.Future<void>.value(), returnValueForMissingStub: _i6.Future<void>.value(),
) as _i5.Future<void>); ) as _i6.Future<void>);
@override @override
_i5.Future<void> remove({required String? themeId}) => (super.noSuchMethod( _i6.Future<void> remove({required String? themeId}) => (super.noSuchMethod(
Invocation.method( Invocation.method(
#remove, #remove,
[], [],
{#themeId: themeId}, {#themeId: themeId},
), ),
returnValue: _i5.Future<void>.value(), returnValue: _i6.Future<void>.value(),
returnValueForMissingStub: _i5.Future<void>.value(), returnValueForMissingStub: _i6.Future<void>.value(),
) as _i5.Future<void>); ) as _i6.Future<void>);
@override @override
_i5.Future<void> checkDefaultThemesOnStartup() => (super.noSuchMethod( _i6.Future<void> checkDefaultThemesOnStartup() => (super.noSuchMethod(
Invocation.method( Invocation.method(
#checkDefaultThemesOnStartup, #checkDefaultThemesOnStartup,
[], [],
), ),
returnValue: _i5.Future<void>.value(), returnValue: _i6.Future<void>.value(),
returnValueForMissingStub: _i5.Future<void>.value(), returnValueForMissingStub: _i6.Future<void>.value(),
) as _i5.Future<void>); ) as _i6.Future<void>);
@override @override
_i5.Future<bool> verifyInstalled({required String? themeId}) => _i6.Future<bool> verifyInstalled({required String? themeId}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#verifyInstalled, #verifyInstalled,
[], [],
{#themeId: themeId}, {#themeId: themeId},
), ),
returnValue: _i5.Future<bool>.value(false), returnValue: _i6.Future<bool>.value(false),
) as _i5.Future<bool>); ) as _i6.Future<bool>);
@override @override
_i5.Future<List<_i3.StackThemeMetaData>> fetchThemes() => (super.noSuchMethod( _i6.Future<List<_i4.StackThemeMetaData>> fetchThemes() => (super.noSuchMethod(
Invocation.method( Invocation.method(
#fetchThemes, #fetchThemes,
[], [],
), ),
returnValue: _i5.Future<List<_i3.StackThemeMetaData>>.value( returnValue: _i6.Future<List<_i4.StackThemeMetaData>>.value(
<_i3.StackThemeMetaData>[]), <_i4.StackThemeMetaData>[]),
) as _i5.Future<List<_i3.StackThemeMetaData>>); ) as _i6.Future<List<_i4.StackThemeMetaData>>);
@override @override
_i5.Future<_i6.Uint8List> fetchTheme( _i6.Future<_i7.Uint8List> fetchTheme(
{required _i3.StackThemeMetaData? themeMetaData}) => {required _i4.StackThemeMetaData? themeMetaData}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#fetchTheme, #fetchTheme,
[], [],
{#themeMetaData: themeMetaData}, {#themeMetaData: themeMetaData},
), ),
returnValue: _i5.Future<_i6.Uint8List>.value(_i6.Uint8List(0)), returnValue: _i6.Future<_i7.Uint8List>.value(_i7.Uint8List(0)),
) as _i5.Future<_i6.Uint8List>); ) as _i6.Future<_i7.Uint8List>);
@override @override
_i4.StackTheme? getTheme({required String? themeId}) => _i5.StackTheme? getTheme({required String? themeId}) =>
(super.noSuchMethod(Invocation.method( (super.noSuchMethod(Invocation.method(
#getTheme, #getTheme,
[], [],
{#themeId: themeId}, {#themeId: themeId},
)) as _i4.StackTheme?); )) as _i5.StackTheme?);
} }

File diff suppressed because it is too large Load diff

View file

@ -1,17 +1,18 @@
import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:hive_test/hive_test.dart'; import 'package:hive_test/hive_test.dart';
import 'package:http/http.dart';
import 'package:mockito/annotations.dart'; import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart'; import 'package:mockito/mockito.dart';
import 'package:stackwallet/db/hive/db.dart'; import 'package:stackwallet/db/hive/db.dart';
import 'package:stackwallet/networking/http.dart';
import 'package:stackwallet/services/price.dart'; import 'package:stackwallet/services/price.dart';
import 'price_test.mocks.dart'; import 'price_test.mocks.dart';
@GenerateMocks([Client]) @GenerateMocks([HTTP])
void main() { void main() {
setUp(() async { setUp(() async {
await setUpTestHive(); await setUpTestHive();
@ -22,10 +23,11 @@ void main() {
}); });
test("getPricesAnd24hChange fetch", () async { test("getPricesAnd24hChange fetch", () async {
final client = MockClient(); final client = MockHTTP();
when(client.get( when(client.get(
Uri.parse( proxyInfo: null,
url: Uri.parse(
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids" "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids"
"=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin,bitcoin-cash" "=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin,bitcoin-cash"
",namecoin,wownero,ethereum,particl,nano,banano,stellar,tezos" ",namecoin,wownero,ethereum,particl,nano,banano,stellar,tezos"
@ -34,6 +36,7 @@ void main() {
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
})).thenAnswer((_) async => Response( })).thenAnswer((_) async => Response(
utf8.encode(
'[{"id":"bitcoin","symbol":"btc","name":"Bitcoin","image":"https://asse' '[{"id":"bitcoin","symbol":"btc","name":"Bitcoin","image":"https://asse'
'ts.coingecko.com/coins/images/1/large/bitcoin.png?1547033579","curr' 'ts.coingecko.com/coins/images/1/large/bitcoin.png?1547033579","curr'
'ent_price":1.0,"market_cap":19128800,"market_cap_rank":1,"fully_dil' 'ent_price":1.0,"market_cap":19128800,"market_cap_rank":1,"fully_dil'
@ -90,7 +93,7 @@ void main() {
'max_supply":null,"ath":0.00013848,"ath_change_percentage":-79.75864' 'max_supply":null,"ath":0.00013848,"ath_change_percentage":-79.75864'
',"ath_date":"2021-12-11T08:39:41.129Z","atl":5.74028e-07,"atl_chang' ',"ath_date":"2021-12-11T08:39:41.129Z","atl":5.74028e-07,"atl_chang'
'e_percentage":4783.08078,"atl_date":"2020-03-13T16:55:01.177Z","roi' 'e_percentage":4783.08078,"atl_date":"2020-03-13T16:55:01.177Z","roi'
'":null,"last_updated":"2022-08-22T16:38:32.826Z"}]', '":null,"last_updated":"2022-08-22T16:38:32.826Z"}]'),
200)); 200));
final priceAPI = PriceAPI(client); final priceAPI = PriceAPI(client);
@ -126,7 +129,8 @@ void main() {
'}', '}',
); );
verify(client.get( verify(client.get(
Uri.parse( proxyInfo: null,
url: Uri.parse(
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc" "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc"
"&ids=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin," "&ids=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin,"
"bitcoin-cash,namecoin,wownero,ethereum,particl,nano,banano,stellar" "bitcoin-cash,namecoin,wownero,ethereum,particl,nano,banano,stellar"
@ -139,10 +143,11 @@ void main() {
}); });
test("cached price fetch", () async { test("cached price fetch", () async {
final client = MockClient(); final client = MockHTTP();
when(client.get( when(client.get(
Uri.parse( proxyInfo: null,
url: Uri.parse(
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&" "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&"
"ids=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin," "ids=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin,"
"bitcoin-cash,namecoin,wownero,ethereum,particl,nano,banano,stellar" "bitcoin-cash,namecoin,wownero,ethereum,particl,nano,banano,stellar"
@ -151,6 +156,7 @@ void main() {
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
})).thenAnswer((_) async => Response( })).thenAnswer((_) async => Response(
utf8.encode(
'[{"id":"bitcoin","symbol":"btc","name":"Bitcoin","image":"https://a' '[{"id":"bitcoin","symbol":"btc","name":"Bitcoin","image":"https://a'
'ssets.coingecko.com/coins/images/1/large/bitcoin.png?1547033579","c' 'ssets.coingecko.com/coins/images/1/large/bitcoin.png?1547033579","c'
'urrent_price":1.0,"market_cap":19128800,"market_cap_rank":1,"fully_' 'urrent_price":1.0,"market_cap":19128800,"market_cap_rank":1,"fully_'
@ -207,7 +213,7 @@ void main() {
'21000000.0,"max_supply":null,"ath":0.00013848,"ath_change_percentag' '21000000.0,"max_supply":null,"ath":0.00013848,"ath_change_percentag'
'e":-79.75864,"ath_date":"2021-12-11T08:39:41.129Z","atl":5.74028e-0' 'e":-79.75864,"ath_date":"2021-12-11T08:39:41.129Z","atl":5.74028e-0'
'7,"atl_change_percentage":4783.08078,"atl_date":"2020-03-13T16:55:01' '7,"atl_change_percentage":4783.08078,"atl_date":"2020-03-13T16:55:01'
'.177Z","roi":null,"last_updated":"2022-08-22T16:38:32.826Z"}]', '.177Z","roi":null,"last_updated":"2022-08-22T16:38:32.826Z"}]'),
200)); 200));
final priceAPI = PriceAPI(client); final priceAPI = PriceAPI(client);
@ -247,7 +253,8 @@ void main() {
// verify only called once during filling of cache // verify only called once during filling of cache
verify(client.get( verify(client.get(
Uri.parse( proxyInfo: null,
url: Uri.parse(
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids" "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids"
"=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin," "=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin,"
"bitcoin-cash,namecoin,wownero,ethereum,particl,nano,banano,stellar" "bitcoin-cash,namecoin,wownero,ethereum,particl,nano,banano,stellar"
@ -259,10 +266,11 @@ void main() {
}); });
test("response parse failure", () async { test("response parse failure", () async {
final client = MockClient(); final client = MockHTTP();
when(client.get( when(client.get(
Uri.parse( proxyInfo: null,
url: Uri.parse(
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc" "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc"
"&ids=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin," "&ids=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin,"
"bitcoin-cash,namecoin,wownero,ethereum,particl,nano,banano,stellar" "bitcoin-cash,namecoin,wownero,ethereum,particl,nano,banano,stellar"
@ -271,6 +279,7 @@ void main() {
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
})).thenAnswer((_) async => Response( })).thenAnswer((_) async => Response(
utf8.encode(
'[{"id":"bitcoin","symbol":"btc","name":com/coins/images/1/large/' '[{"id":"bitcoin","symbol":"btc","name":com/coins/images/1/large/'
'bitcoin.png?1547033579","current_price":1.0,"market_cap":19128800' 'bitcoin.png?1547033579","current_price":1.0,"market_cap":19128800'
',"market_cap_rank":1,"fully_diluted_valuation":21000000,"total_volum' ',"market_cap_rank":1,"fully_diluted_valuation":21000000,"total_volum'
@ -328,7 +337,7 @@ void main() {
'y":21000000.0,"max_supply":null,"ath":0.00013848,"ath_change_perce' 'y":21000000.0,"max_supply":null,"ath":0.00013848,"ath_change_perce'
'ntage":-79.75864,"ath_date":"2021-12-11T08:39:41.129Z","atl":5.74' 'ntage":-79.75864,"ath_date":"2021-12-11T08:39:41.129Z","atl":5.74'
'028e-07,"atl_change_percentage":4783.08078,"atl_date":"2020-03-13T' '028e-07,"atl_change_percentage":4783.08078,"atl_date":"2020-03-13T'
'16:55:01.177Z","roi":null,"last_updated":"2022-08-22T16:38:32.826Z"}]', '16:55:01.177Z","roi":null,"last_updated":"2022-08-22T16:38:32.826Z"}]'),
200)); 200));
final priceAPI = PriceAPI(client); final priceAPI = PriceAPI(client);
@ -365,10 +374,11 @@ void main() {
}); });
test("no internet available", () async { test("no internet available", () async {
final client = MockClient(); final client = MockHTTP();
when(client.get( when(client.get(
Uri.parse( proxyInfo: null,
url: Uri.parse(
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc" "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc"
"&ids=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin," "&ids=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin,"
"bitcoin-cash,namecoin,wownero,ethereum,particl,nano,banano,stellar" "bitcoin-cash,namecoin,wownero,ethereum,particl,nano,banano,stellar"

View file

@ -4,11 +4,11 @@
// ignore_for_file: no_leading_underscores_for_library_prefixes // ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:async' as _i3; import 'dart:async' as _i3;
import 'dart:convert' as _i4; import 'dart:convert' as _i5;
import 'dart:typed_data' as _i5; import 'dart:io' as _i4;
import 'package:http/http.dart' as _i2;
import 'package:mockito/mockito.dart' as _i1; import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/networking/http.dart' as _i2;
// ignore_for_file: type=lint // ignore_for_file: type=lint
// ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_redundant_argument_values
@ -31,233 +31,76 @@ class _FakeResponse_0 extends _i1.SmartFake implements _i2.Response {
); );
} }
class _FakeStreamedResponse_1 extends _i1.SmartFake /// A class which mocks [HTTP].
implements _i2.StreamedResponse {
_FakeStreamedResponse_1(
Object parent,
Invocation parentInvocation,
) : super(
parent,
parentInvocation,
);
}
/// A class which mocks [Client].
/// ///
/// See the documentation for Mockito's code generation for more information. /// See the documentation for Mockito's code generation for more information.
class MockClient extends _i1.Mock implements _i2.Client { class MockHTTP extends _i1.Mock implements _i2.HTTP {
MockClient() { MockHTTP() {
_i1.throwOnMissingStub(this); _i1.throwOnMissingStub(this);
} }
@override @override
_i3.Future<_i2.Response> head( _i3.Future<_i2.Response> get({
Uri? url, { required Uri? url,
Map<String, String>? headers,
}) =>
(super.noSuchMethod(
Invocation.method(
#head,
[url],
{#headers: headers},
),
returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0(
this,
Invocation.method(
#head,
[url],
{#headers: headers},
),
)),
) as _i3.Future<_i2.Response>);
@override
_i3.Future<_i2.Response> get(
Uri? url, {
Map<String, String>? headers, Map<String, String>? headers,
required ({_i4.InternetAddress host, int port})? proxyInfo,
}) => }) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#get, #get,
[url],
{#headers: headers},
),
returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0(
this,
Invocation.method(
#get,
[url],
{#headers: headers},
),
)),
) as _i3.Future<_i2.Response>);
@override
_i3.Future<_i2.Response> post(
Uri? url, {
Map<String, String>? headers,
Object? body,
_i4.Encoding? encoding,
}) =>
(super.noSuchMethod(
Invocation.method(
#post,
[url],
{
#headers: headers,
#body: body,
#encoding: encoding,
},
),
returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0(
this,
Invocation.method(
#post,
[url],
{
#headers: headers,
#body: body,
#encoding: encoding,
},
),
)),
) as _i3.Future<_i2.Response>);
@override
_i3.Future<_i2.Response> put(
Uri? url, {
Map<String, String>? headers,
Object? body,
_i4.Encoding? encoding,
}) =>
(super.noSuchMethod(
Invocation.method(
#put,
[url],
{
#headers: headers,
#body: body,
#encoding: encoding,
},
),
returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0(
this,
Invocation.method(
#put,
[url],
{
#headers: headers,
#body: body,
#encoding: encoding,
},
),
)),
) as _i3.Future<_i2.Response>);
@override
_i3.Future<_i2.Response> patch(
Uri? url, {
Map<String, String>? headers,
Object? body,
_i4.Encoding? encoding,
}) =>
(super.noSuchMethod(
Invocation.method(
#patch,
[url],
{
#headers: headers,
#body: body,
#encoding: encoding,
},
),
returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0(
this,
Invocation.method(
#patch,
[url],
{
#headers: headers,
#body: body,
#encoding: encoding,
},
),
)),
) as _i3.Future<_i2.Response>);
@override
_i3.Future<_i2.Response> delete(
Uri? url, {
Map<String, String>? headers,
Object? body,
_i4.Encoding? encoding,
}) =>
(super.noSuchMethod(
Invocation.method(
#delete,
[url],
{
#headers: headers,
#body: body,
#encoding: encoding,
},
),
returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0(
this,
Invocation.method(
#delete,
[url],
{
#headers: headers,
#body: body,
#encoding: encoding,
},
),
)),
) as _i3.Future<_i2.Response>);
@override
_i3.Future<String> read(
Uri? url, {
Map<String, String>? headers,
}) =>
(super.noSuchMethod(
Invocation.method(
#read,
[url],
{#headers: headers},
),
returnValue: _i3.Future<String>.value(''),
) as _i3.Future<String>);
@override
_i3.Future<_i5.Uint8List> readBytes(
Uri? url, {
Map<String, String>? headers,
}) =>
(super.noSuchMethod(
Invocation.method(
#readBytes,
[url],
{#headers: headers},
),
returnValue: _i3.Future<_i5.Uint8List>.value(_i5.Uint8List(0)),
) as _i3.Future<_i5.Uint8List>);
@override
_i3.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) =>
(super.noSuchMethod(
Invocation.method(
#send,
[request],
),
returnValue:
_i3.Future<_i2.StreamedResponse>.value(_FakeStreamedResponse_1(
this,
Invocation.method(
#send,
[request],
),
)),
) as _i3.Future<_i2.StreamedResponse>);
@override
void close() => super.noSuchMethod(
Invocation.method(
#close,
[], [],
{
#url: url,
#headers: headers,
#proxyInfo: proxyInfo,
},
), ),
returnValueForMissingStub: null, returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0(
); this,
Invocation.method(
#get,
[],
{
#url: url,
#headers: headers,
#proxyInfo: proxyInfo,
},
),
)),
) as _i3.Future<_i2.Response>);
@override
_i3.Future<_i2.Response> post({
required Uri? url,
Map<String, String>? headers,
Object? body,
_i5.Encoding? encoding,
required ({_i4.InternetAddress host, int port})? proxyInfo,
}) =>
(super.noSuchMethod(
Invocation.method(
#post,
[],
{
#url: url,
#headers: headers,
#body: body,
#encoding: encoding,
#proxyInfo: proxyInfo,
},
),
returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0(
this,
Invocation.method(
#post,
[],
{
#url: url,
#headers: headers,
#body: body,
#encoding: encoding,
#proxyInfo: proxyInfo,
},
),
)),
) as _i3.Future<_i2.Response>);
} }

View file

@ -244,14 +244,14 @@ class MockPrefs extends _i1.Mock implements _i4.Prefs {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
bool get torKillswitch => (super.noSuchMethod( bool get torKillSwitch => (super.noSuchMethod(
Invocation.getter(#torKillswitch), Invocation.getter(#torKillSwitch),
returnValue: false, returnValue: false,
) as bool); ) as bool);
@override @override
set torKillswitch(bool? torKillswitch) => super.noSuchMethod( set torKillSwitch(bool? torKillswitch) => super.noSuchMethod(
Invocation.setter( Invocation.setter(
#torKillswitch, #torKillSwitch,
torKillswitch, torKillswitch,
), ),
returnValueForMissingStub: null, returnValueForMissingStub: null,

View file

@ -3,13 +3,14 @@
// Do not manually edit this file. // Do not manually edit this file.
// ignore_for_file: no_leading_underscores_for_library_prefixes // ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:async' as _i5; import 'dart:async' as _i6;
import 'dart:typed_data' as _i6; import 'dart:typed_data' as _i7;
import 'package:mockito/mockito.dart' as _i1; import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/db/isar/main_db.dart' as _i2; import 'package:stackwallet/db/isar/main_db.dart' as _i3;
import 'package:stackwallet/models/isar/stack_theme.dart' as _i4; import 'package:stackwallet/models/isar/stack_theme.dart' as _i5;
import 'package:stackwallet/themes/theme_service.dart' as _i3; import 'package:stackwallet/networking/http.dart' as _i2;
import 'package:stackwallet/themes/theme_service.dart' as _i4;
// ignore_for_file: type=lint // ignore_for_file: type=lint
// ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_redundant_argument_values
@ -22,8 +23,18 @@ import 'package:stackwallet/themes/theme_service.dart' as _i3;
// ignore_for_file: camel_case_types // ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class // ignore_for_file: subtype_of_sealed_class
class _FakeMainDB_0 extends _i1.SmartFake implements _i2.MainDB { class _FakeHTTP_0 extends _i1.SmartFake implements _i2.HTTP {
_FakeMainDB_0( _FakeHTTP_0(
Object parent,
Invocation parentInvocation,
) : super(
parent,
parentInvocation,
);
}
class _FakeMainDB_1 extends _i1.SmartFake implements _i3.MainDB {
_FakeMainDB_1(
Object parent, Object parent,
Invocation parentInvocation, Invocation parentInvocation,
) : super( ) : super(
@ -35,26 +46,42 @@ class _FakeMainDB_0 extends _i1.SmartFake implements _i2.MainDB {
/// A class which mocks [ThemeService]. /// A class which mocks [ThemeService].
/// ///
/// See the documentation for Mockito's code generation for more information. /// See the documentation for Mockito's code generation for more information.
class MockThemeService extends _i1.Mock implements _i3.ThemeService { class MockThemeService extends _i1.Mock implements _i4.ThemeService {
MockThemeService() { MockThemeService() {
_i1.throwOnMissingStub(this); _i1.throwOnMissingStub(this);
} }
@override @override
_i2.MainDB get db => (super.noSuchMethod( _i2.HTTP get client => (super.noSuchMethod(
Invocation.getter(#client),
returnValue: _FakeHTTP_0(
this,
Invocation.getter(#client),
),
) as _i2.HTTP);
@override
set client(_i2.HTTP? _client) => super.noSuchMethod(
Invocation.setter(
#client,
_client,
),
returnValueForMissingStub: null,
);
@override
_i3.MainDB get db => (super.noSuchMethod(
Invocation.getter(#db), Invocation.getter(#db),
returnValue: _FakeMainDB_0( returnValue: _FakeMainDB_1(
this, this,
Invocation.getter(#db), Invocation.getter(#db),
), ),
) as _i2.MainDB); ) as _i3.MainDB);
@override @override
List<_i4.StackTheme> get installedThemes => (super.noSuchMethod( List<_i5.StackTheme> get installedThemes => (super.noSuchMethod(
Invocation.getter(#installedThemes), Invocation.getter(#installedThemes),
returnValue: <_i4.StackTheme>[], returnValue: <_i5.StackTheme>[],
) as List<_i4.StackTheme>); ) as List<_i5.StackTheme>);
@override @override
void init(_i2.MainDB? db) => super.noSuchMethod( void init(_i3.MainDB? db) => super.noSuchMethod(
Invocation.method( Invocation.method(
#init, #init,
[db], [db],
@ -62,70 +89,70 @@ class MockThemeService extends _i1.Mock implements _i3.ThemeService {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
_i5.Future<void> install({required _i6.Uint8List? themeArchiveData}) => _i6.Future<void> install({required _i7.Uint8List? themeArchiveData}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#install, #install,
[], [],
{#themeArchiveData: themeArchiveData}, {#themeArchiveData: themeArchiveData},
), ),
returnValue: _i5.Future<void>.value(), returnValue: _i6.Future<void>.value(),
returnValueForMissingStub: _i5.Future<void>.value(), returnValueForMissingStub: _i6.Future<void>.value(),
) as _i5.Future<void>); ) as _i6.Future<void>);
@override @override
_i5.Future<void> remove({required String? themeId}) => (super.noSuchMethod( _i6.Future<void> remove({required String? themeId}) => (super.noSuchMethod(
Invocation.method( Invocation.method(
#remove, #remove,
[], [],
{#themeId: themeId}, {#themeId: themeId},
), ),
returnValue: _i5.Future<void>.value(), returnValue: _i6.Future<void>.value(),
returnValueForMissingStub: _i5.Future<void>.value(), returnValueForMissingStub: _i6.Future<void>.value(),
) as _i5.Future<void>); ) as _i6.Future<void>);
@override @override
_i5.Future<void> checkDefaultThemesOnStartup() => (super.noSuchMethod( _i6.Future<void> checkDefaultThemesOnStartup() => (super.noSuchMethod(
Invocation.method( Invocation.method(
#checkDefaultThemesOnStartup, #checkDefaultThemesOnStartup,
[], [],
), ),
returnValue: _i5.Future<void>.value(), returnValue: _i6.Future<void>.value(),
returnValueForMissingStub: _i5.Future<void>.value(), returnValueForMissingStub: _i6.Future<void>.value(),
) as _i5.Future<void>); ) as _i6.Future<void>);
@override @override
_i5.Future<bool> verifyInstalled({required String? themeId}) => _i6.Future<bool> verifyInstalled({required String? themeId}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#verifyInstalled, #verifyInstalled,
[], [],
{#themeId: themeId}, {#themeId: themeId},
), ),
returnValue: _i5.Future<bool>.value(false), returnValue: _i6.Future<bool>.value(false),
) as _i5.Future<bool>); ) as _i6.Future<bool>);
@override @override
_i5.Future<List<_i3.StackThemeMetaData>> fetchThemes() => (super.noSuchMethod( _i6.Future<List<_i4.StackThemeMetaData>> fetchThemes() => (super.noSuchMethod(
Invocation.method( Invocation.method(
#fetchThemes, #fetchThemes,
[], [],
), ),
returnValue: _i5.Future<List<_i3.StackThemeMetaData>>.value( returnValue: _i6.Future<List<_i4.StackThemeMetaData>>.value(
<_i3.StackThemeMetaData>[]), <_i4.StackThemeMetaData>[]),
) as _i5.Future<List<_i3.StackThemeMetaData>>); ) as _i6.Future<List<_i4.StackThemeMetaData>>);
@override @override
_i5.Future<_i6.Uint8List> fetchTheme( _i6.Future<_i7.Uint8List> fetchTheme(
{required _i3.StackThemeMetaData? themeMetaData}) => {required _i4.StackThemeMetaData? themeMetaData}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#fetchTheme, #fetchTheme,
[], [],
{#themeMetaData: themeMetaData}, {#themeMetaData: themeMetaData},
), ),
returnValue: _i5.Future<_i6.Uint8List>.value(_i6.Uint8List(0)), returnValue: _i6.Future<_i7.Uint8List>.value(_i7.Uint8List(0)),
) as _i5.Future<_i6.Uint8List>); ) as _i6.Future<_i7.Uint8List>);
@override @override
_i4.StackTheme? getTheme({required String? themeId}) => _i5.StackTheme? getTheme({required String? themeId}) =>
(super.noSuchMethod(Invocation.method( (super.noSuchMethod(Invocation.method(
#getTheme, #getTheme,
[], [],
{#themeId: themeId}, {#themeId: themeId},
)) as _i4.StackTheme?); )) as _i5.StackTheme?);
} }

View file

@ -3,13 +3,14 @@
// Do not manually edit this file. // Do not manually edit this file.
// ignore_for_file: no_leading_underscores_for_library_prefixes // ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:async' as _i5; import 'dart:async' as _i6;
import 'dart:typed_data' as _i6; import 'dart:typed_data' as _i7;
import 'package:mockito/mockito.dart' as _i1; import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/db/isar/main_db.dart' as _i2; import 'package:stackwallet/db/isar/main_db.dart' as _i3;
import 'package:stackwallet/models/isar/stack_theme.dart' as _i4; import 'package:stackwallet/models/isar/stack_theme.dart' as _i5;
import 'package:stackwallet/themes/theme_service.dart' as _i3; import 'package:stackwallet/networking/http.dart' as _i2;
import 'package:stackwallet/themes/theme_service.dart' as _i4;
// ignore_for_file: type=lint // ignore_for_file: type=lint
// ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_redundant_argument_values
@ -22,8 +23,18 @@ import 'package:stackwallet/themes/theme_service.dart' as _i3;
// ignore_for_file: camel_case_types // ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class // ignore_for_file: subtype_of_sealed_class
class _FakeMainDB_0 extends _i1.SmartFake implements _i2.MainDB { class _FakeHTTP_0 extends _i1.SmartFake implements _i2.HTTP {
_FakeMainDB_0( _FakeHTTP_0(
Object parent,
Invocation parentInvocation,
) : super(
parent,
parentInvocation,
);
}
class _FakeMainDB_1 extends _i1.SmartFake implements _i3.MainDB {
_FakeMainDB_1(
Object parent, Object parent,
Invocation parentInvocation, Invocation parentInvocation,
) : super( ) : super(
@ -35,26 +46,42 @@ class _FakeMainDB_0 extends _i1.SmartFake implements _i2.MainDB {
/// A class which mocks [ThemeService]. /// A class which mocks [ThemeService].
/// ///
/// See the documentation for Mockito's code generation for more information. /// See the documentation for Mockito's code generation for more information.
class MockThemeService extends _i1.Mock implements _i3.ThemeService { class MockThemeService extends _i1.Mock implements _i4.ThemeService {
MockThemeService() { MockThemeService() {
_i1.throwOnMissingStub(this); _i1.throwOnMissingStub(this);
} }
@override @override
_i2.MainDB get db => (super.noSuchMethod( _i2.HTTP get client => (super.noSuchMethod(
Invocation.getter(#client),
returnValue: _FakeHTTP_0(
this,
Invocation.getter(#client),
),
) as _i2.HTTP);
@override
set client(_i2.HTTP? _client) => super.noSuchMethod(
Invocation.setter(
#client,
_client,
),
returnValueForMissingStub: null,
);
@override
_i3.MainDB get db => (super.noSuchMethod(
Invocation.getter(#db), Invocation.getter(#db),
returnValue: _FakeMainDB_0( returnValue: _FakeMainDB_1(
this, this,
Invocation.getter(#db), Invocation.getter(#db),
), ),
) as _i2.MainDB); ) as _i3.MainDB);
@override @override
List<_i4.StackTheme> get installedThemes => (super.noSuchMethod( List<_i5.StackTheme> get installedThemes => (super.noSuchMethod(
Invocation.getter(#installedThemes), Invocation.getter(#installedThemes),
returnValue: <_i4.StackTheme>[], returnValue: <_i5.StackTheme>[],
) as List<_i4.StackTheme>); ) as List<_i5.StackTheme>);
@override @override
void init(_i2.MainDB? db) => super.noSuchMethod( void init(_i3.MainDB? db) => super.noSuchMethod(
Invocation.method( Invocation.method(
#init, #init,
[db], [db],
@ -62,70 +89,70 @@ class MockThemeService extends _i1.Mock implements _i3.ThemeService {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
_i5.Future<void> install({required _i6.Uint8List? themeArchiveData}) => _i6.Future<void> install({required _i7.Uint8List? themeArchiveData}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#install, #install,
[], [],
{#themeArchiveData: themeArchiveData}, {#themeArchiveData: themeArchiveData},
), ),
returnValue: _i5.Future<void>.value(), returnValue: _i6.Future<void>.value(),
returnValueForMissingStub: _i5.Future<void>.value(), returnValueForMissingStub: _i6.Future<void>.value(),
) as _i5.Future<void>); ) as _i6.Future<void>);
@override @override
_i5.Future<void> remove({required String? themeId}) => (super.noSuchMethod( _i6.Future<void> remove({required String? themeId}) => (super.noSuchMethod(
Invocation.method( Invocation.method(
#remove, #remove,
[], [],
{#themeId: themeId}, {#themeId: themeId},
), ),
returnValue: _i5.Future<void>.value(), returnValue: _i6.Future<void>.value(),
returnValueForMissingStub: _i5.Future<void>.value(), returnValueForMissingStub: _i6.Future<void>.value(),
) as _i5.Future<void>); ) as _i6.Future<void>);
@override @override
_i5.Future<void> checkDefaultThemesOnStartup() => (super.noSuchMethod( _i6.Future<void> checkDefaultThemesOnStartup() => (super.noSuchMethod(
Invocation.method( Invocation.method(
#checkDefaultThemesOnStartup, #checkDefaultThemesOnStartup,
[], [],
), ),
returnValue: _i5.Future<void>.value(), returnValue: _i6.Future<void>.value(),
returnValueForMissingStub: _i5.Future<void>.value(), returnValueForMissingStub: _i6.Future<void>.value(),
) as _i5.Future<void>); ) as _i6.Future<void>);
@override @override
_i5.Future<bool> verifyInstalled({required String? themeId}) => _i6.Future<bool> verifyInstalled({required String? themeId}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#verifyInstalled, #verifyInstalled,
[], [],
{#themeId: themeId}, {#themeId: themeId},
), ),
returnValue: _i5.Future<bool>.value(false), returnValue: _i6.Future<bool>.value(false),
) as _i5.Future<bool>); ) as _i6.Future<bool>);
@override @override
_i5.Future<List<_i3.StackThemeMetaData>> fetchThemes() => (super.noSuchMethod( _i6.Future<List<_i4.StackThemeMetaData>> fetchThemes() => (super.noSuchMethod(
Invocation.method( Invocation.method(
#fetchThemes, #fetchThemes,
[], [],
), ),
returnValue: _i5.Future<List<_i3.StackThemeMetaData>>.value( returnValue: _i6.Future<List<_i4.StackThemeMetaData>>.value(
<_i3.StackThemeMetaData>[]), <_i4.StackThemeMetaData>[]),
) as _i5.Future<List<_i3.StackThemeMetaData>>); ) as _i6.Future<List<_i4.StackThemeMetaData>>);
@override @override
_i5.Future<_i6.Uint8List> fetchTheme( _i6.Future<_i7.Uint8List> fetchTheme(
{required _i3.StackThemeMetaData? themeMetaData}) => {required _i4.StackThemeMetaData? themeMetaData}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#fetchTheme, #fetchTheme,
[], [],
{#themeMetaData: themeMetaData}, {#themeMetaData: themeMetaData},
), ),
returnValue: _i5.Future<_i6.Uint8List>.value(_i6.Uint8List(0)), returnValue: _i6.Future<_i7.Uint8List>.value(_i7.Uint8List(0)),
) as _i5.Future<_i6.Uint8List>); ) as _i6.Future<_i7.Uint8List>);
@override @override
_i4.StackTheme? getTheme({required String? themeId}) => _i5.StackTheme? getTheme({required String? themeId}) =>
(super.noSuchMethod(Invocation.method( (super.noSuchMethod(Invocation.method(
#getTheme, #getTheme,
[], [],
{#themeId: themeId}, {#themeId: themeId},
)) as _i4.StackTheme?); )) as _i5.StackTheme?);
} }

View file

@ -3,13 +3,14 @@
// Do not manually edit this file. // Do not manually edit this file.
// ignore_for_file: no_leading_underscores_for_library_prefixes // ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:async' as _i5; import 'dart:async' as _i6;
import 'dart:typed_data' as _i6; import 'dart:typed_data' as _i7;
import 'package:mockito/mockito.dart' as _i1; import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/db/isar/main_db.dart' as _i2; import 'package:stackwallet/db/isar/main_db.dart' as _i3;
import 'package:stackwallet/models/isar/stack_theme.dart' as _i4; import 'package:stackwallet/models/isar/stack_theme.dart' as _i5;
import 'package:stackwallet/themes/theme_service.dart' as _i3; import 'package:stackwallet/networking/http.dart' as _i2;
import 'package:stackwallet/themes/theme_service.dart' as _i4;
// ignore_for_file: type=lint // ignore_for_file: type=lint
// ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_redundant_argument_values
@ -22,8 +23,18 @@ import 'package:stackwallet/themes/theme_service.dart' as _i3;
// ignore_for_file: camel_case_types // ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class // ignore_for_file: subtype_of_sealed_class
class _FakeMainDB_0 extends _i1.SmartFake implements _i2.MainDB { class _FakeHTTP_0 extends _i1.SmartFake implements _i2.HTTP {
_FakeMainDB_0( _FakeHTTP_0(
Object parent,
Invocation parentInvocation,
) : super(
parent,
parentInvocation,
);
}
class _FakeMainDB_1 extends _i1.SmartFake implements _i3.MainDB {
_FakeMainDB_1(
Object parent, Object parent,
Invocation parentInvocation, Invocation parentInvocation,
) : super( ) : super(
@ -35,26 +46,42 @@ class _FakeMainDB_0 extends _i1.SmartFake implements _i2.MainDB {
/// A class which mocks [ThemeService]. /// A class which mocks [ThemeService].
/// ///
/// See the documentation for Mockito's code generation for more information. /// See the documentation for Mockito's code generation for more information.
class MockThemeService extends _i1.Mock implements _i3.ThemeService { class MockThemeService extends _i1.Mock implements _i4.ThemeService {
MockThemeService() { MockThemeService() {
_i1.throwOnMissingStub(this); _i1.throwOnMissingStub(this);
} }
@override @override
_i2.MainDB get db => (super.noSuchMethod( _i2.HTTP get client => (super.noSuchMethod(
Invocation.getter(#client),
returnValue: _FakeHTTP_0(
this,
Invocation.getter(#client),
),
) as _i2.HTTP);
@override
set client(_i2.HTTP? _client) => super.noSuchMethod(
Invocation.setter(
#client,
_client,
),
returnValueForMissingStub: null,
);
@override
_i3.MainDB get db => (super.noSuchMethod(
Invocation.getter(#db), Invocation.getter(#db),
returnValue: _FakeMainDB_0( returnValue: _FakeMainDB_1(
this, this,
Invocation.getter(#db), Invocation.getter(#db),
), ),
) as _i2.MainDB); ) as _i3.MainDB);
@override @override
List<_i4.StackTheme> get installedThemes => (super.noSuchMethod( List<_i5.StackTheme> get installedThemes => (super.noSuchMethod(
Invocation.getter(#installedThemes), Invocation.getter(#installedThemes),
returnValue: <_i4.StackTheme>[], returnValue: <_i5.StackTheme>[],
) as List<_i4.StackTheme>); ) as List<_i5.StackTheme>);
@override @override
void init(_i2.MainDB? db) => super.noSuchMethod( void init(_i3.MainDB? db) => super.noSuchMethod(
Invocation.method( Invocation.method(
#init, #init,
[db], [db],
@ -62,70 +89,70 @@ class MockThemeService extends _i1.Mock implements _i3.ThemeService {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
_i5.Future<void> install({required _i6.Uint8List? themeArchiveData}) => _i6.Future<void> install({required _i7.Uint8List? themeArchiveData}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#install, #install,
[], [],
{#themeArchiveData: themeArchiveData}, {#themeArchiveData: themeArchiveData},
), ),
returnValue: _i5.Future<void>.value(), returnValue: _i6.Future<void>.value(),
returnValueForMissingStub: _i5.Future<void>.value(), returnValueForMissingStub: _i6.Future<void>.value(),
) as _i5.Future<void>); ) as _i6.Future<void>);
@override @override
_i5.Future<void> remove({required String? themeId}) => (super.noSuchMethod( _i6.Future<void> remove({required String? themeId}) => (super.noSuchMethod(
Invocation.method( Invocation.method(
#remove, #remove,
[], [],
{#themeId: themeId}, {#themeId: themeId},
), ),
returnValue: _i5.Future<void>.value(), returnValue: _i6.Future<void>.value(),
returnValueForMissingStub: _i5.Future<void>.value(), returnValueForMissingStub: _i6.Future<void>.value(),
) as _i5.Future<void>); ) as _i6.Future<void>);
@override @override
_i5.Future<void> checkDefaultThemesOnStartup() => (super.noSuchMethod( _i6.Future<void> checkDefaultThemesOnStartup() => (super.noSuchMethod(
Invocation.method( Invocation.method(
#checkDefaultThemesOnStartup, #checkDefaultThemesOnStartup,
[], [],
), ),
returnValue: _i5.Future<void>.value(), returnValue: _i6.Future<void>.value(),
returnValueForMissingStub: _i5.Future<void>.value(), returnValueForMissingStub: _i6.Future<void>.value(),
) as _i5.Future<void>); ) as _i6.Future<void>);
@override @override
_i5.Future<bool> verifyInstalled({required String? themeId}) => _i6.Future<bool> verifyInstalled({required String? themeId}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#verifyInstalled, #verifyInstalled,
[], [],
{#themeId: themeId}, {#themeId: themeId},
), ),
returnValue: _i5.Future<bool>.value(false), returnValue: _i6.Future<bool>.value(false),
) as _i5.Future<bool>); ) as _i6.Future<bool>);
@override @override
_i5.Future<List<_i3.StackThemeMetaData>> fetchThemes() => (super.noSuchMethod( _i6.Future<List<_i4.StackThemeMetaData>> fetchThemes() => (super.noSuchMethod(
Invocation.method( Invocation.method(
#fetchThemes, #fetchThemes,
[], [],
), ),
returnValue: _i5.Future<List<_i3.StackThemeMetaData>>.value( returnValue: _i6.Future<List<_i4.StackThemeMetaData>>.value(
<_i3.StackThemeMetaData>[]), <_i4.StackThemeMetaData>[]),
) as _i5.Future<List<_i3.StackThemeMetaData>>); ) as _i6.Future<List<_i4.StackThemeMetaData>>);
@override @override
_i5.Future<_i6.Uint8List> fetchTheme( _i6.Future<_i7.Uint8List> fetchTheme(
{required _i3.StackThemeMetaData? themeMetaData}) => {required _i4.StackThemeMetaData? themeMetaData}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#fetchTheme, #fetchTheme,
[], [],
{#themeMetaData: themeMetaData}, {#themeMetaData: themeMetaData},
), ),
returnValue: _i5.Future<_i6.Uint8List>.value(_i6.Uint8List(0)), returnValue: _i6.Future<_i7.Uint8List>.value(_i7.Uint8List(0)),
) as _i5.Future<_i6.Uint8List>); ) as _i6.Future<_i7.Uint8List>);
@override @override
_i4.StackTheme? getTheme({required String? themeId}) => _i5.StackTheme? getTheme({required String? themeId}) =>
(super.noSuchMethod(Invocation.method( (super.noSuchMethod(Invocation.method(
#getTheme, #getTheme,
[], [],
{#themeId: themeId}, {#themeId: themeId},
)) as _i4.StackTheme?); )) as _i5.StackTheme?);
} }

File diff suppressed because it is too large Load diff

View file

@ -23,6 +23,7 @@ import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i15;
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart' import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart'
as _i7; as _i7;
import 'package:stackwallet/utilities/prefs.dart' as _i13; import 'package:stackwallet/utilities/prefs.dart' as _i13;
import 'package:tor_ffi_plugin/tor_ffi_plugin.dart' as _i20;
import 'package:tuple/tuple.dart' as _i11; import 'package:tuple/tuple.dart' as _i11;
// ignore_for_file: type=lint // ignore_for_file: type=lint
@ -483,14 +484,14 @@ class MockPrefs extends _i1.Mock implements _i13.Prefs {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
bool get torKillswitch => (super.noSuchMethod( bool get torKillSwitch => (super.noSuchMethod(
Invocation.getter(#torKillswitch), Invocation.getter(#torKillSwitch),
returnValue: false, returnValue: false,
) as bool); ) as bool);
@override @override
set torKillswitch(bool? torKillswitch) => super.noSuchMethod( set torKillSwitch(bool? torKillswitch) => super.noSuchMethod(
Invocation.setter( Invocation.setter(
#torKillswitch, #torKillSwitch,
torKillswitch, torKillswitch,
), ),
returnValueForMissingStub: null, returnValueForMissingStub: null,
@ -1040,6 +1041,15 @@ class MockTorService extends _i1.Mock implements _i19.TorService {
), ),
) as ({_i8.InternetAddress host, int port})); ) as ({_i8.InternetAddress host, int port}));
@override @override
void init({_i20.Tor? mockableOverride}) => super.noSuchMethod(
Invocation.method(
#init,
[],
{#mockableOverride: mockableOverride},
),
returnValueForMissingStub: null,
);
@override
_i12.Future<void> start() => (super.noSuchMethod( _i12.Future<void> start() => (super.noSuchMethod(
Invocation.method( Invocation.method(
#start, #start,

File diff suppressed because it is too large Load diff

View file

@ -3,13 +3,14 @@
// Do not manually edit this file. // Do not manually edit this file.
// ignore_for_file: no_leading_underscores_for_library_prefixes // ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:async' as _i5; import 'dart:async' as _i6;
import 'dart:typed_data' as _i6; import 'dart:typed_data' as _i7;
import 'package:mockito/mockito.dart' as _i1; import 'package:mockito/mockito.dart' as _i1;
import 'package:stackwallet/db/isar/main_db.dart' as _i2; import 'package:stackwallet/db/isar/main_db.dart' as _i3;
import 'package:stackwallet/models/isar/stack_theme.dart' as _i4; import 'package:stackwallet/models/isar/stack_theme.dart' as _i5;
import 'package:stackwallet/themes/theme_service.dart' as _i3; import 'package:stackwallet/networking/http.dart' as _i2;
import 'package:stackwallet/themes/theme_service.dart' as _i4;
// ignore_for_file: type=lint // ignore_for_file: type=lint
// ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_redundant_argument_values
@ -22,8 +23,18 @@ import 'package:stackwallet/themes/theme_service.dart' as _i3;
// ignore_for_file: camel_case_types // ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class // ignore_for_file: subtype_of_sealed_class
class _FakeMainDB_0 extends _i1.SmartFake implements _i2.MainDB { class _FakeHTTP_0 extends _i1.SmartFake implements _i2.HTTP {
_FakeMainDB_0( _FakeHTTP_0(
Object parent,
Invocation parentInvocation,
) : super(
parent,
parentInvocation,
);
}
class _FakeMainDB_1 extends _i1.SmartFake implements _i3.MainDB {
_FakeMainDB_1(
Object parent, Object parent,
Invocation parentInvocation, Invocation parentInvocation,
) : super( ) : super(
@ -35,26 +46,42 @@ class _FakeMainDB_0 extends _i1.SmartFake implements _i2.MainDB {
/// A class which mocks [ThemeService]. /// A class which mocks [ThemeService].
/// ///
/// See the documentation for Mockito's code generation for more information. /// See the documentation for Mockito's code generation for more information.
class MockThemeService extends _i1.Mock implements _i3.ThemeService { class MockThemeService extends _i1.Mock implements _i4.ThemeService {
MockThemeService() { MockThemeService() {
_i1.throwOnMissingStub(this); _i1.throwOnMissingStub(this);
} }
@override @override
_i2.MainDB get db => (super.noSuchMethod( _i2.HTTP get client => (super.noSuchMethod(
Invocation.getter(#client),
returnValue: _FakeHTTP_0(
this,
Invocation.getter(#client),
),
) as _i2.HTTP);
@override
set client(_i2.HTTP? _client) => super.noSuchMethod(
Invocation.setter(
#client,
_client,
),
returnValueForMissingStub: null,
);
@override
_i3.MainDB get db => (super.noSuchMethod(
Invocation.getter(#db), Invocation.getter(#db),
returnValue: _FakeMainDB_0( returnValue: _FakeMainDB_1(
this, this,
Invocation.getter(#db), Invocation.getter(#db),
), ),
) as _i2.MainDB); ) as _i3.MainDB);
@override @override
List<_i4.StackTheme> get installedThemes => (super.noSuchMethod( List<_i5.StackTheme> get installedThemes => (super.noSuchMethod(
Invocation.getter(#installedThemes), Invocation.getter(#installedThemes),
returnValue: <_i4.StackTheme>[], returnValue: <_i5.StackTheme>[],
) as List<_i4.StackTheme>); ) as List<_i5.StackTheme>);
@override @override
void init(_i2.MainDB? db) => super.noSuchMethod( void init(_i3.MainDB? db) => super.noSuchMethod(
Invocation.method( Invocation.method(
#init, #init,
[db], [db],
@ -62,78 +89,78 @@ class MockThemeService extends _i1.Mock implements _i3.ThemeService {
returnValueForMissingStub: null, returnValueForMissingStub: null,
); );
@override @override
_i5.Future<void> install({required _i6.Uint8List? themeArchiveData}) => _i6.Future<void> install({required _i7.Uint8List? themeArchiveData}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#install, #install,
[], [],
{#themeArchiveData: themeArchiveData}, {#themeArchiveData: themeArchiveData},
), ),
returnValue: _i5.Future<void>.value(), returnValue: _i6.Future<void>.value(),
returnValueForMissingStub: _i5.Future<void>.value(), returnValueForMissingStub: _i6.Future<void>.value(),
) as _i5.Future<void>); ) as _i6.Future<void>);
@override @override
_i5.Future<void> remove({required String? themeId}) => (super.noSuchMethod( _i6.Future<void> remove({required String? themeId}) => (super.noSuchMethod(
Invocation.method( Invocation.method(
#remove, #remove,
[], [],
{#themeId: themeId}, {#themeId: themeId},
), ),
returnValue: _i5.Future<void>.value(), returnValue: _i6.Future<void>.value(),
returnValueForMissingStub: _i5.Future<void>.value(), returnValueForMissingStub: _i6.Future<void>.value(),
) as _i5.Future<void>); ) as _i6.Future<void>);
@override @override
_i5.Future<void> checkDefaultThemesOnStartup() => (super.noSuchMethod( _i6.Future<void> checkDefaultThemesOnStartup() => (super.noSuchMethod(
Invocation.method( Invocation.method(
#checkDefaultThemesOnStartup, #checkDefaultThemesOnStartup,
[], [],
), ),
returnValue: _i5.Future<void>.value(), returnValue: _i6.Future<void>.value(),
returnValueForMissingStub: _i5.Future<void>.value(), returnValueForMissingStub: _i6.Future<void>.value(),
) as _i5.Future<void>); ) as _i6.Future<void>);
@override @override
_i5.Future<bool> verifyInstalled({required String? themeId}) => _i6.Future<bool> verifyInstalled({required String? themeId}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#verifyInstalled, #verifyInstalled,
[], [],
{#themeId: themeId}, {#themeId: themeId},
), ),
returnValue: _i5.Future<bool>.value(false), returnValue: _i6.Future<bool>.value(false),
) as _i5.Future<bool>); ) as _i6.Future<bool>);
@override @override
_i5.Future<List<_i3.StackThemeMetaData>> fetchThemes() => (super.noSuchMethod( _i6.Future<List<_i4.StackThemeMetaData>> fetchThemes() => (super.noSuchMethod(
Invocation.method( Invocation.method(
#fetchThemes, #fetchThemes,
[], [],
), ),
returnValue: _i5.Future<List<_i3.StackThemeMetaData>>.value( returnValue: _i6.Future<List<_i4.StackThemeMetaData>>.value(
<_i3.StackThemeMetaData>[]), <_i4.StackThemeMetaData>[]),
) as _i5.Future<List<_i3.StackThemeMetaData>>); ) as _i6.Future<List<_i4.StackThemeMetaData>>);
@override @override
_i5.Future<_i6.Uint8List> fetchTheme( _i6.Future<_i7.Uint8List> fetchTheme(
{required _i3.StackThemeMetaData? themeMetaData}) => {required _i4.StackThemeMetaData? themeMetaData}) =>
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method( Invocation.method(
#fetchTheme, #fetchTheme,
[], [],
{#themeMetaData: themeMetaData}, {#themeMetaData: themeMetaData},
), ),
returnValue: _i5.Future<_i6.Uint8List>.value(_i6.Uint8List(0)), returnValue: _i6.Future<_i7.Uint8List>.value(_i7.Uint8List(0)),
) as _i5.Future<_i6.Uint8List>); ) as _i6.Future<_i7.Uint8List>);
@override @override
_i4.StackTheme? getTheme({required String? themeId}) => _i5.StackTheme? getTheme({required String? themeId}) =>
(super.noSuchMethod(Invocation.method( (super.noSuchMethod(Invocation.method(
#getTheme, #getTheme,
[], [],
{#themeId: themeId}, {#themeId: themeId},
)) as _i4.StackTheme?); )) as _i5.StackTheme?);
} }
/// A class which mocks [IThemeAssets]. /// A class which mocks [IThemeAssets].
/// ///
/// See the documentation for Mockito's code generation for more information. /// See the documentation for Mockito's code generation for more information.
class MockIThemeAssets extends _i1.Mock implements _i4.IThemeAssets { class MockIThemeAssets extends _i1.Mock implements _i5.IThemeAssets {
MockIThemeAssets() { MockIThemeAssets() {
_i1.throwOnMissingStub(this); _i1.throwOnMissingStub(this);
} }

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff