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() {
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)));

@ -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(

@ -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,

Loading…
Cancel
Save