From 399e34eefda0e31b306a9c9f2c5760ff759bc41b Mon Sep 17 00:00:00 2001 From: alestiago Date: Thu, 31 Mar 2022 09:57:01 +0100 Subject: [PATCH] refactor: stored test lengths --- .../game/components/controlled_ball_test.dart | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/test/game/components/controlled_ball_test.dart b/test/game/components/controlled_ball_test.dart index 080dc357..262ffc0e 100644 --- a/test/game/components/controlled_ball_test.dart +++ b/test/game/components/controlled_ball_test.dart @@ -95,15 +95,12 @@ void main() { await game.add(ball); await game.ready(); - final previousBalls = game.descendants().whereType(); + final previousBalls = game.descendants().whereType().length; controller.lost(); await game.ready(); - final currentBalls = game.descendants().whereType(); + final currentBalls = game.descendants().whereType().length; - expect( - previousBalls.length, - equals(currentBalls.length), - ); + expect(previousBalls, equals(currentBalls)); }, ); @@ -126,16 +123,14 @@ void main() { await game.add(ball); await game.ready(); - final previousBalls = game.descendants().whereType(); + final previousBalls = game.descendants().whereType().toList(); controller.lost(); await game.ready(); - final currentBalls = game.descendants().whereType(); + final currentBalls = game.descendants().whereType().length; expect( - currentBalls.length, - equals( - (previousBalls.toList()..remove(ball)).length, - ), + currentBalls, + equals((previousBalls..remove(ball)).length), ); }, );