diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-24 15:38:36 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-24 15:38:36 -0600 |
| commit | 7fb5255aafc435f5b47725716963f3aebfb9feb2 (patch) | |
| tree | 2779faa2ce03296013722086019262bbc390cadf /app/controllers/sparkles | |
| parent | 5f04ff8b3051d176dca586357ed68482d62b8eef (diff) | |
test: Validate Entity ObjectReference
Diffstat (limited to 'app/controllers/sparkles')
| -rw-r--r-- | app/controllers/sparkles/controller_test.go | 5 |
1 files changed, 3 insertions, 2 deletions
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( |
