From 6ec63942cf16261442a1acd88bc076ba577a4348 Mon Sep 17 00:00:00 2001 From: alestiago Date: Thu, 21 Apr 2022 13:58:28 +0100 Subject: [PATCH] refactor: improved tests --- .../test/src/blueprint_test.dart | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/packages/pinball_flame/test/src/blueprint_test.dart b/packages/pinball_flame/test/src/blueprint_test.dart index 5de977b3..18fb7e12 100644 --- a/packages/pinball_flame/test/src/blueprint_test.dart +++ b/packages/pinball_flame/test/src/blueprint_test.dart @@ -20,12 +20,17 @@ void main() { ], ); await game.addFromBlueprint(blueprint); - expect(game.children, equals(blueprint.components)); + + expect( + game.children.length, + equals(blueprint.components.length), + ); + for (final component in blueprint.components) { + expect(game.children.contains(component), isTrue); + } }); - flameTester - .test('adds components from a child Blueprint the to a game on attach', - (game) async { + flameTester.test('adds components from a child Blueprint', (game) async { final childBlueprint = Blueprint( components: [ Component(), @@ -45,13 +50,13 @@ void main() { await game.addFromBlueprint(parentBlueprint); await game.ready(); - expect( - game.children, - equals([ - ...parentBlueprint.components, - ...childBlueprint.components, - ]), - ); + for (final component in childBlueprint.components) { + expect(game.children, contains(component)); + expect(parentBlueprint.components, contains(component)); + } + for (final component in parentBlueprint.components) { + expect(game.children, contains(component)); + } }); }); }