diff --git a/packages/pinball_components/test/src/components/layer_test.dart b/packages/pinball_components/test/src/components/layer_test.dart index 0b92bc96..0f0175c4 100644 --- a/packages/pinball_components/test/src/components/layer_test.dart +++ b/packages/pinball_components/test/src/components/layer_test.dart @@ -14,24 +14,6 @@ class TestBodyComponent extends BodyComponent with Layered { } } -class TestNestedBodyComponent extends BodyComponent with Layered { - TestNestedBodyComponent({required this.childLayer}); - - final Layer childLayer; - - @override - Body createBody() { - final fixtureDef = FixtureDef(CircleShape()); - return world.createBody(BodyDef())..createFixture(fixtureDef); - } - - @override - Future onLoad() async { - await super.onLoad(); - await add(TestBodyComponent()..layer = childLayer); - } -} - void main() { final flameTester = FlameTester(Forge2DGame.new); @@ -146,8 +128,9 @@ void main() { const parentLayer = Layer.jetpack; const childLayer = Layer.board; - final component = TestNestedBodyComponent(childLayer: childLayer) - ..layer = parentLayer; + final component = TestBodyComponent()..layer = parentLayer; + final childComponent = TestBodyComponent()..layer = childLayer; + await component.add(childComponent); await game.ensureAdd(component); expect(childLayer, isNot(equals(parentLayer))); diff --git a/packages/pinball_components/test/src/components/shapes/arc_shape_test.dart b/packages/pinball_components/test/src/components/shapes/arc_shape_test.dart index 6cf4ca88..f7563ee6 100644 --- a/packages/pinball_components/test/src/components/shapes/arc_shape_test.dart +++ b/packages/pinball_components/test/src/components/shapes/arc_shape_test.dart @@ -20,7 +20,9 @@ void main() { }); group('copyWith', () { - test('returns same shape when no properties are passed', () { + test( + 'copies correctly ' + 'when no argument specified', () { final arcShape = ArcShape( center: Vector2.zero(), arcRadius: 10, @@ -37,19 +39,26 @@ void main() { } }); - test('returns object with updated properties when are passed', () { + test( + 'copies correctly ' + 'when all arguments specified', () { final arcShapeExpected = ArcShape( center: Vector2.all(10), - arcRadius: 10, + arcRadius: 15, angle: 2 * math.pi, - rotation: 0, + rotation: math.pi, ); final arcShapeCopied = ArcShape( center: Vector2.zero(), arcRadius: 10, - angle: 2 * math.pi, + angle: math.pi, rotation: 0, - ).copyWith(center: Vector2.all(10)); + ).copyWith( + center: Vector2.all(10), + arcRadius: 15, + angle: 2 * math.pi, + rotation: math.pi, + ); for (var index = 0; index < arcShapeCopied.vertices.length; index++) { expect( diff --git a/test/game/bloc/game_state_test.dart b/test/game/bloc/game_state_test.dart index aa8bdf66..9ca913ab 100644 --- a/test/game/bloc/game_state_test.dart +++ b/test/game/bloc/game_state_test.dart @@ -186,7 +186,7 @@ void main() { test( 'copies correctly ' - 'when no arguement specified', + 'when no argument specified', () { const gameState = GameState( balls: 0, @@ -204,7 +204,7 @@ void main() { test( 'copies correctly ' - 'when all arguements specified', + 'when all arguments specified', () { const gameState = GameState( score: 2,