fix tests

This commit is contained in:
Hayden 2023-01-28 11:41:09 -09:00
parent 47e8f553ff
commit 672923d58e
No known key found for this signature in database
GPG key ID: 17CF79474E257545
3 changed files with 6 additions and 13 deletions

View file

@ -27,7 +27,7 @@ func (Group) Fields() []ent.Field {
NotEmpty(), NotEmpty(),
field.Enum("currency"). field.Enum("currency").
Default("usd"). Default("usd").
Values("usd", "eur", "gbp", "jpy", "zar", "aud", "nok", "sek", "dkk", "inr", "rmb"), Values("usd", "eur", "gbp", "jpy", "zar", "aud", "nok", "sek", "dkk", "inr", "rmb", "bgn"),
} }
} }

View file

@ -176,9 +176,7 @@ func (r *LocationRepository) Create(ctx context.Context, GID uuid.UUID, data Loc
SetDescription(data.Description). SetDescription(data.Description).
SetGroupID(GID) SetGroupID(GID)
println(data.ParentID.String())
if data.ParentID != uuid.Nil { if data.ParentID != uuid.Nil {
println("SET PARENT")
q.SetParentID(data.ParentID) q.SetParentID(data.ParentID)
} }

View file

@ -138,19 +138,14 @@ func TestItemRepository_TreeQuery(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
assert.Equal(t, 3, len(locations)) assert.Equal(t, 2, len(locations))
for _, loc := range locs { // Check roots
found := false for _, loc := range locations {
if loc.ID == locs[1].ID {
for _, l := range locations { assert.Equal(t, 1, len(loc.Children))
if l.ID == loc.ID {
found = true
} }
} }
assert.True(t, found)
}
} }
func TestConvertLocationsToTree(t *testing.T) { func TestConvertLocationsToTree(t *testing.T) {