I think I found the issue. I still investigating, but I notice that my function to initializa items wasn't define and ID for Items.
After this moditification on that struct:
func initializeItem(name string) *Item {
return &Item{
ItemID: valueobjects.NewItemID(uuid.New()),
name: name,
}
}
and change my tests a little bit:
t.Run("Retrieve unexisting item from vault", func(t *testing.T) {
var vaultErr *VaultError
vault.AddItem(item1, regPlayer)
vaultSize := len(vault.Items)
err := vault.RetriveItem(item.PickRandomItem(), regPlayer)
assert.Error(t, vault.RetriveItem(item3, regPlayer))
assert.ErrorAs(t, err, &vaultErr)
assert.Contains(t, vaultErr.Error(), ErrItemNotFound.Error())
assert.Equal(t, vaultSize, len(vault.Items))
})
It starting to working.
I need to do more investigation to understand this. But for now, it working!