From 7fb5255aafc435f5b47725716963f3aebfb9feb2 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 24 Jul 2025 15:38:36 -0600 Subject: test: Validate Entity ObjectReference --- app/controllers/sparkles/controller_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'app/controllers/sparkles') diff --git a/app/controllers/sparkles/controller_test.go b/app/controllers/sparkles/controller_test.go index e825343..710118d 100644 --- a/app/controllers/sparkles/controller_test.go +++ b/app/controllers/sparkles/controller_test.go @@ -11,6 +11,7 @@ import ( "github.com/xlgmokha/x/pkg/event" "github.com/xlgmokha/x/pkg/serde" "github.com/xlgmokha/x/pkg/test" + "github.com/xlgmokha/x/pkg/x" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/cfg" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/db" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/domain" @@ -64,7 +65,7 @@ func TestSparkles(t *testing.T) { t.Run("POST /sparkles", func(t *testing.T) { t.Run("when a user is authenticated", func(t *testing.T) { - currentUser := domain.NewUser(domain.WithID[*domain.User](domain.ID("1"))) + currentUser := x.New[*domain.User](domain.WithID[*domain.User](domain.ID("1"))) repository := db.NewRepository[*domain.Sparkle](event.New[*domain.Sparkle]()) t.Run("when the user is authorized", func(t *testing.T) { @@ -106,7 +107,7 @@ func TestSparkles(t *testing.T) { }) t.Run("prevents double WriteHeader when serialization fails", func(t *testing.T) { - currentUser := domain.NewUser(domain.WithID[*domain.User](domain.ID("1"))) + currentUser := x.New[*domain.User](domain.WithID[*domain.User](domain.ID("1"))) sparkle, _ := domain.NewSparkle("@user for testing") request, response := test.RequestResponse( -- cgit v1.2.3