fix: broken test
This commit is contained in:
parent
56e5db6898
commit
9151c5b9b3
|
@ -30,7 +30,7 @@ test('visibility-based updates', async () => {
|
||||||
const ecs = engine.ecses['homesteads/0'];
|
const ecs = engine.ecses['homesteads/0'];
|
||||||
// Create an entity.
|
// Create an entity.
|
||||||
const entity = ecs.get(ecs.create({
|
const entity = ecs.get(ecs.create({
|
||||||
Forces: {momentum: {x: 1, y: 0}},
|
Forces: {forceX: 1},
|
||||||
Position: {x: (RESOLUTION.x * 1.5) + 32 - 3, y: 20},
|
Position: {x: (RESOLUTION.x * 1.5) + 32 - 3, y: 20},
|
||||||
VisibleAabb: {},
|
VisibleAabb: {},
|
||||||
}));
|
}));
|
||||||
|
@ -38,6 +38,7 @@ test('visibility-based updates', async () => {
|
||||||
engine.tick(1);
|
engine.tick(1);
|
||||||
expect(engine.updateFor(0))
|
expect(engine.updateFor(0))
|
||||||
.to.deep.include({2: {MainEntity: {}, ...ecs.get(2).toJSON()}, 3: ecs.get(3).toJSON()});
|
.to.deep.include({2: {MainEntity: {}, ...ecs.get(2).toJSON()}, 3: ecs.get(3).toJSON()});
|
||||||
|
engine.setClean();
|
||||||
// Tick and get update. Should be a partial update.
|
// Tick and get update. Should be a partial update.
|
||||||
engine.tick(1);
|
engine.tick(1);
|
||||||
expect(engine.updateFor(0))
|
expect(engine.updateFor(0))
|
||||||
|
@ -50,12 +51,14 @@ test('visibility-based updates', async () => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
engine.setClean();
|
||||||
// Tick and get update. Should remove the entity.
|
// Tick and get update. Should remove the entity.
|
||||||
engine.tick(1);
|
engine.tick(1);
|
||||||
expect(engine.updateFor(0))
|
expect(engine.updateFor(0))
|
||||||
.to.deep.include({3: false});
|
.to.deep.include({3: false});
|
||||||
// Aim back toward visible area and tick. Should be a full update for that entity.
|
// Aim back toward visible area and tick. Should be a full update for that entity.
|
||||||
entity.Momentum.x = -1;
|
engine.setClean();
|
||||||
|
entity.Forces.forceX = -1;
|
||||||
engine.tick(1);
|
engine.tick(1);
|
||||||
expect(engine.updateFor(0))
|
expect(engine.updateFor(0))
|
||||||
.to.deep.include({3: ecs.get(3).toJSON()});
|
.to.deep.include({3: ecs.get(3).toJSON()});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user