Merge branch 'widget-tests' of github.com:cypherstack/stack_wallet into widget-tests

This commit is contained in:
Likho 2022-10-17 18:35:21 +02:00
commit 777ca516bf

View file

@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockingjay/mockingjay.dart' as mockingjay;
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart' as mockito;
import 'package:mockingjay/mockingjay.dart' as mockingjay;
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart';
import 'package:stackwallet/services/coins/coin_service.dart';
@ -33,20 +33,22 @@ void main() {
final wallets = MockWallets();
final locale = MockLocaleService();
final manager = Manager(wallet);
final managerProvider = ChangeNotifierProvider((ref) => manager);
mockito.when(wallets.getManagerProvider("wallet id")).thenAnswer(
(realInvocation) => ChangeNotifierProvider((ref) => manager));
mockito
.when(wallets.getManagerProvider("wallet id"))
.thenAnswer((realInvocation) => managerProvider);
mockito.when(locale.locale).thenAnswer((_) => "en_US");
mockito.when(wallets.getManagerProvider("wallet id")).thenAnswer(
(realInvocation) => ChangeNotifierProvider((ref) => manager));
mockito
.when(wallets.getManagerProvider("wallet id"))
.thenAnswer((realInvocation) => managerProvider);
final navigator = mockingjay.MockNavigator();
mockingjay
.when(() => navigator.pushNamed("/wallet", arguments: [
Tuple2("wallet id", wallets.getManagerProvider("wallet id"))
]))
.thenAnswer((_) async => Object());
.when(() => navigator.pushNamed("/wallet",
arguments: Tuple2("wallet id", managerProvider)))
.thenAnswer((_) async => {});
// mockingjay
// .when(() => navigator.push(mockingjay.any(