Skip to content

Commit

Permalink
Improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
memorycode committed Oct 22, 2024
1 parent a950ccf commit d548852
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/World.spec.luau
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,22 @@ return function()
local entity = world:spawn()
world:insert(entity, A())

world:spawn(A())
--world:insert(entity, B())
expect(world.archetypes[1].edges[#A].add).to.equal(world.archetypes[2])
expect(world.archetypes[2].edges[#A].remove).to.equal(world.archetypes[1])

print(world.archetypes)
world:insert(entity, B())

expect(world.archetypes[2].edges[#B].add).to.equal(world.archetypes[3])
expect(world.archetypes[3].edges[#B].remove).to.equal(world.archetypes[2])

world:remove(entity, A)

expect(world.archetypes[3].edges[#A].remove).to.equal(world.archetypes[4])
expect(world.archetypes[4].edges[#A].add).to.equal(world.archetypes[3])

world:insert(entity, A())

expect(world.allEntities[entity].archetype).to.equal(world.archetypes[3])
end)

it("should allow inserting and removing components from existing entities", function()
Expand Down

0 comments on commit d548852

Please sign in to comment.