From 9432ee89bf480cf25aab0fa23df24c84b688fd9b Mon Sep 17 00:00:00 2001 From: julian Date: Wed, 2 Nov 2022 17:47:24 -0600 Subject: [PATCH] node card test fix --- test/widget_tests/node_card_test.dart | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/test/widget_tests/node_card_test.dart b/test/widget_tests/node_card_test.dart index 2728fc304..22e0661bf 100644 --- a/test/widget_tests/node_card_test.dart +++ b/test/widget_tests/node_card_test.dart @@ -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);