fix: broken test

This commit is contained in:
cha0s 2024-06-26 07:39:11 -05:00
parent 56e5db6898
commit 9151c5b9b3

View File

@ -30,7 +30,7 @@ test('visibility-based updates', async () => {
const ecs = engine.ecses['homesteads/0'];
// Create an entity.
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},
VisibleAabb: {},
}));
@ -38,6 +38,7 @@ test('visibility-based updates', async () => {
engine.tick(1);
expect(engine.updateFor(0))
.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.
engine.tick(1);
expect(engine.updateFor(0))
@ -50,12 +51,14 @@ test('visibility-based updates', async () => {
},
},
});
engine.setClean();
// Tick and get update. Should remove the entity.
engine.tick(1);
expect(engine.updateFor(0))
.to.deep.include({3: false});
// 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);
expect(engine.updateFor(0))
.to.deep.include({3: ecs.get(3).toJSON()});