From 1d79d7e7dc7010d147f9a23d2ca0c003a6f51274 Mon Sep 17 00:00:00 2001 From: Allison Ryan Date: Tue, 3 May 2022 11:08:38 -0500 Subject: [PATCH] refactor: make launcher tests more robust --- test/game/components/launcher_test.dart | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/test/game/components/launcher_test.dart b/test/game/components/launcher_test.dart index 816e0b65..c76e6b7e 100644 --- a/test/game/components/launcher_test.dart +++ b/test/game/components/launcher_test.dart @@ -41,8 +41,9 @@ void main() { final launcher = Launcher(); await game.ensureAdd(launcher); - final launchRamp = launcher.firstChild(); - expect(launchRamp, isNotNull); + final descendantsQuery = + launcher.descendants().whereType(); + expect(descendantsQuery.length, equals(1)); }, ); @@ -52,8 +53,8 @@ void main() { final launcher = Launcher(); await game.ensureAdd(launcher); - final flapper = launcher.firstChild(); - expect(flapper, isNotNull); + final descendantsQuery = launcher.descendants().whereType(); + expect(descendantsQuery.length, equals(1)); }, ); @@ -63,8 +64,8 @@ void main() { final launcher = Launcher(); await game.ensureAdd(launcher); - final plunger = launcher.firstChild(); - expect(plunger, isNotNull); + final descendantsQuery = launcher.descendants().whereType(); + expect(descendantsQuery.length, equals(1)); }, ); @@ -74,8 +75,9 @@ void main() { final launcher = Launcher(); await game.ensureAdd(launcher); - final rocket = launcher.firstChild(); - expect(rocket, isNotNull); + final descendantsQuery = + launcher.descendants().whereType(); + expect(descendantsQuery.length, equals(1)); }, ); });