Skip to content

Commit

Permalink
test: add get test
Browse files Browse the repository at this point in the history
  • Loading branch information
andygeiss committed Aug 16, 2024
1 parent 917d1a0 commit 10830aa
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions core/entity_manager_default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,22 @@ func TestEntityManager_FilterByNames_Should_Return_Three_Entities_Out_Of_Three(t
t.Errorf("Entity should have correct Id, but got %s", filtered[2].Id)
}
}

func TestEntityManager_Get_Should_Return_Entity(t *testing.T) {
em := core.NewEntityManager()
e1 := core.NewEntity("e1", []core.Component{
&mockComponent{name: "position", mask: 1},
&mockComponent{name: "size", mask: 2},
})
e2 := core.NewEntity("e2", []core.Component{
&mockComponent{name: "position", mask: 1},
&mockComponent{name: "size", mask: 2},
})
em.Add(e1, e2)
if e := em.Get("e1"); e == nil {
t.Error("Entity should not be nil")
}
if e := em.Get("e2"); e == nil {
t.Error("Entity should not be nil")
}
}

0 comments on commit 10830aa

Please sign in to comment.