summaryrefslogtreecommitdiff
path: root/app/controllers/sparkles/controller_test.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-05-07 10:47:31 -0700
committermo khan <mo@mokhan.ca>2025-05-07 10:47:31 -0700
commitc82468b1b32ad5bfb347fe65cd5dcfb6680795d1 (patch)
tree679b4728fdae2ed296730a49f5100ddcf3c25f98 /app/controllers/sparkles/controller_test.go
parentf0fbdab72254d68d0a3a4a49a4a1646f89f0f913 (diff)
refactor: provide context to repository to apply timeout
Diffstat (limited to 'app/controllers/sparkles/controller_test.go')
-rw-r--r--app/controllers/sparkles/controller_test.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/sparkles/controller_test.go b/app/controllers/sparkles/controller_test.go
index b2c7752..8a1717d 100644
--- a/app/controllers/sparkles/controller_test.go
+++ b/app/controllers/sparkles/controller_test.go
@@ -17,7 +17,7 @@ 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.Save(sparkle)
+ store.Save(t.Context(), sparkle)
mux := http.NewServeMux()
controller := New(store)
@@ -75,8 +75,8 @@ func TestSparkles(t *testing.T) {
})
t.Run("saves the sparkle to the db", func(t *testing.T) {
- assert.Equal(t, 1, len(repository.All()))
- item := repository.All()[0]
+ assert.Equal(t, 1, len(repository.All(t.Context())))
+ item := repository.All(t.Context())[0]
assert.Equal(t, "@tanuki", item.Sparklee)
assert.Equal(t, "for reviewing my code!", item.Reason)