From 5c95a9978206c8563c295abb6e263695d553ee1e Mon Sep 17 00:00:00 2001 From: tom-anders <13141438+tom-anders@users.noreply.github.com> Date: Fri, 27 Dec 2024 11:30:25 +0100 Subject: [PATCH] use tearDown to reset mock --- test/widgets/board_test.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/widgets/board_test.dart b/test/widgets/board_test.dart index 108d096..b7b70b1 100644 --- a/test/widgets/board_test.dart +++ b/test/widgets/board_test.dart @@ -18,6 +18,10 @@ class OnTappedSquareMock extends Mock { void main() { group('Non-interactive board', () { final onTappedSquare = OnTappedSquareMock(); + tearDown(() { + reset(onTappedSquare); + }); + final viewOnlyBoard = Chessboard.fixed( size: boardSize, orientation: Side.white, @@ -36,8 +40,6 @@ void main() { }); testWidgets('cannot select piece', (WidgetTester tester) async { - reset(onTappedSquare); - await tester.pumpWidget(viewOnlyBoard); await tester.tap(find.byKey(const Key('e2-whitepawn'))); await tester.pump();