test: changed tests names

pull/87/head
RuiAlonso 4 years ago
parent c786d730fd
commit 9faba244b5

@ -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<void> onLoad() async {
await super.onLoad();
await add(TestBodyComponent()..layer = childLayer);
}
}
void main() { void main() {
final flameTester = FlameTester(Forge2DGame.new); final flameTester = FlameTester(Forge2DGame.new);
@ -146,8 +128,9 @@ void main() {
const parentLayer = Layer.jetpack; const parentLayer = Layer.jetpack;
const childLayer = Layer.board; const childLayer = Layer.board;
final component = TestNestedBodyComponent(childLayer: childLayer) final component = TestBodyComponent()..layer = parentLayer;
..layer = parentLayer; final childComponent = TestBodyComponent()..layer = childLayer;
await component.add(childComponent);
await game.ensureAdd(component); await game.ensureAdd(component);
expect(childLayer, isNot(equals(parentLayer))); expect(childLayer, isNot(equals(parentLayer)));

@ -20,7 +20,9 @@ void main() {
}); });
group('copyWith', () { group('copyWith', () {
test('returns same shape when no properties are passed', () { test(
'copies correctly '
'when no argument specified', () {
final arcShape = ArcShape( final arcShape = ArcShape(
center: Vector2.zero(), center: Vector2.zero(),
arcRadius: 10, 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( final arcShapeExpected = ArcShape(
center: Vector2.all(10), center: Vector2.all(10),
arcRadius: 10, arcRadius: 15,
angle: 2 * math.pi, angle: 2 * math.pi,
rotation: 0, rotation: math.pi,
); );
final arcShapeCopied = ArcShape( final arcShapeCopied = ArcShape(
center: Vector2.zero(), center: Vector2.zero(),
arcRadius: 10, arcRadius: 10,
angle: 2 * math.pi, angle: math.pi,
rotation: 0, 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++) { for (var index = 0; index < arcShapeCopied.vertices.length; index++) {
expect( expect(

@ -186,7 +186,7 @@ void main() {
test( test(
'copies correctly ' 'copies correctly '
'when no arguement specified', 'when no argument specified',
() { () {
const gameState = GameState( const gameState = GameState(
balls: 0, balls: 0,
@ -204,7 +204,7 @@ void main() {
test( test(
'copies correctly ' 'copies correctly '
'when all arguements specified', 'when all arguments specified',
() { () {
const gameState = GameState( const gameState = GameState(
score: 2, score: 2,

Loading…
Cancel
Save