summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-24 13:38:27 -0600
committermo khan <mo@mokhan.ca>2025-07-24 13:38:27 -0600
commit863ab07212e4044dab656609f1c8fdf578134e84 (patch)
tree2add50a0043bccd9e5246da786bcb87681d1c15d /app/controllers
parentdb82a14aa4942293b2b9726d297bfeb71f2bf79b (diff)
feat: publish an event after a new sparkle is saved to the database
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/sparkles/controller_test.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/controllers/sparkles/controller_test.go b/app/controllers/sparkles/controller_test.go
index d2469a7..e825343 100644
--- a/app/controllers/sparkles/controller_test.go
+++ b/app/controllers/sparkles/controller_test.go
@@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "github.com/xlgmokha/x/pkg/event"
"github.com/xlgmokha/x/pkg/serde"
"github.com/xlgmokha/x/pkg/test"
"gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/cfg"
@@ -35,7 +36,7 @@ func (f *FailingResponseWriter) Write([]byte) (int, error) {
func TestSparkles(t *testing.T) {
t.Run("GET /sparkles", func(t *testing.T) {
sparkle, _ := domain.NewSparkle("@tanuki for helping me")
- store := db.NewRepository[*domain.Sparkle]()
+ store := db.NewRepository[*domain.Sparkle](event.New[*domain.Sparkle]())
store.Save(t.Context(), sparkle)
mux := http.NewServeMux()
@@ -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")))
- repository := db.NewRepository[*domain.Sparkle]()
+ repository := db.NewRepository[*domain.Sparkle](event.New[*domain.Sparkle]())
t.Run("when the user is authorized", func(t *testing.T) {
mux := http.NewServeMux()