mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 03:49:22 +00:00
node card test fix
This commit is contained in:
parent
9186be7fb6
commit
9432ee89bf
1 changed files with 18 additions and 8 deletions
|
@ -1,15 +1,16 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:stackwallet/models/node_model.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/services/node_service.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/theme/light_colors.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/services/node_service.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/widgets/node_card.dart';
|
||||
import 'package:stackwallet/widgets/node_options_sheet.dart';
|
||||
|
||||
|
@ -190,13 +191,22 @@ void main() {
|
|||
await tester.tap(find.byType(NodeCard));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text("Connect"), findsOneWidget);
|
||||
expect(find.text("Details"), findsOneWidget);
|
||||
expect(find.byType(NodeOptionsSheet), findsOneWidget);
|
||||
expect(find.byType(Text), findsNWidgets(7));
|
||||
if (Util.isDesktop) {
|
||||
expect(find.text("Connect"), findsNothing);
|
||||
expect(find.text("Details"), findsNothing);
|
||||
|
||||
verify(nodeService.getPrimaryNodeFor(coin: Coin.bitcoin)).called(1);
|
||||
verify(nodeService.getNodeById(id: "node id")).called(1);
|
||||
} else {
|
||||
expect(find.text("Connect"), findsOneWidget);
|
||||
expect(find.text("Details"), findsOneWidget);
|
||||
expect(find.byType(NodeOptionsSheet), findsOneWidget);
|
||||
expect(find.byType(Text), findsNWidgets(7));
|
||||
|
||||
verify(nodeService.getPrimaryNodeFor(coin: Coin.bitcoin)).called(2);
|
||||
verify(nodeService.getNodeById(id: "node id")).called(2);
|
||||
}
|
||||
|
||||
verify(nodeService.getPrimaryNodeFor(coin: Coin.bitcoin)).called(2);
|
||||
verify(nodeService.getNodeById(id: "node id")).called(2);
|
||||
verify(nodeService.addListener(any)).called(1);
|
||||
|
||||
verifyNoMoreInteractions(nodeService);
|
||||
|
|
Loading…
Reference in a new issue