Skip to content

Commit

Permalink
use tearDown to reset mock
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-anders committed Dec 27, 2024
1 parent 42816b8 commit 5c95a99
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/widgets/board_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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();
Expand Down

0 comments on commit 5c95a99

Please sign in to comment.