node card test fix

This commit is contained in:
julian 2022-11-02 17:47:24 -06:00
parent 9186be7fb6
commit 9432ee89bf

View file

@ -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,6 +191,13 @@ void main() {
await tester.tap(find.byType(NodeCard));
await tester.pumpAndSettle();
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);
@ -197,6 +205,8 @@ void main() {
verify(nodeService.getPrimaryNodeFor(coin: Coin.bitcoin)).called(2);
verify(nodeService.getNodeById(id: "node id")).called(2);
}
verify(nodeService.addListener(any)).called(1);
verifyNoMoreInteractions(nodeService);