From 672923d58e53ab07a2b1092a683418489af651ee Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Sat, 28 Jan 2023 11:41:09 -0900 Subject: [PATCH] fix tests --- backend/internal/data/ent/schema/group.go | 2 +- backend/internal/data/repo/repo_locations.go | 2 -- backend/internal/data/repo/repo_locations_test.go | 15 +++++---------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/backend/internal/data/ent/schema/group.go b/backend/internal/data/ent/schema/group.go index a2011d8..2c0a5fe 100644 --- a/backend/internal/data/ent/schema/group.go +++ b/backend/internal/data/ent/schema/group.go @@ -27,7 +27,7 @@ func (Group) Fields() []ent.Field { NotEmpty(), field.Enum("currency"). 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"), } } diff --git a/backend/internal/data/repo/repo_locations.go b/backend/internal/data/repo/repo_locations.go index 2a5d8ea..a5ca126 100644 --- a/backend/internal/data/repo/repo_locations.go +++ b/backend/internal/data/repo/repo_locations.go @@ -176,9 +176,7 @@ func (r *LocationRepository) Create(ctx context.Context, GID uuid.UUID, data Loc SetDescription(data.Description). SetGroupID(GID) - println(data.ParentID.String()) if data.ParentID != uuid.Nil { - println("SET PARENT") q.SetParentID(data.ParentID) } diff --git a/backend/internal/data/repo/repo_locations_test.go b/backend/internal/data/repo/repo_locations_test.go index 9a72a63..1ef2295 100644 --- a/backend/internal/data/repo/repo_locations_test.go +++ b/backend/internal/data/repo/repo_locations_test.go @@ -138,18 +138,13 @@ func TestItemRepository_TreeQuery(t *testing.T) { assert.NoError(t, err) - assert.Equal(t, 3, len(locations)) + assert.Equal(t, 2, len(locations)) - for _, loc := range locs { - found := false - - for _, l := range locations { - if l.ID == loc.ID { - found = true - } + // Check roots + for _, loc := range locations { + if loc.ID == locs[1].ID { + assert.Equal(t, 1, len(loc.Children)) } - - assert.True(t, found) } }