From fc2fbf2b739d773df626d94977109c4c2847b764 Mon Sep 17 00:00:00 2001 From: Erick Zanardo Date: Thu, 24 Mar 2022 10:48:51 -0300 Subject: [PATCH] fix: coverage --- test/flame/blueprint_test.dart | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/test/flame/blueprint_test.dart b/test/flame/blueprint_test.dart index 0cb48e5c..e5fc2c4f 100644 --- a/test/flame/blueprint_test.dart +++ b/test/flame/blueprint_test.dart @@ -14,10 +14,25 @@ class MyBlueprint extends Blueprint { } } +class MyOtherBlueprint extends Blueprint { + @override + void build(_) { + add(Component()); + } +} + +class YetMyOtherBlueprint extends Blueprint { + @override + void build(_) { + add(Component()); + } +} + class MyComposedBlueprint extends Blueprint { @override void build(_) { addBlueprint(MyBlueprint()); + addAllBlueprints([MyOtherBlueprint(), YetMyOtherBlueprint()]); } } @@ -42,6 +57,12 @@ void main() { expect(blueprint.components.length, equals(3)); }); + test('blueprints can be added to it', () { + final blueprint = MyComposedBlueprint()..build(MockPinballGame()); + + expect(blueprint.blueprints.length, equals(3)); + }); + test('adds the components to a game on attach', () { final mockGame = MockPinballGame(); when(() => mockGame.addAll(any())).thenAnswer((_) async {}); @@ -55,7 +76,7 @@ void main() { when(() => mockGame.addAll(any())).thenAnswer((_) async {}); MyComposedBlueprint().attach(mockGame); - verify(() => mockGame.addAll(any())).called(2); + verify(() => mockGame.addAll(any())).called(4); }); test(