aboutsummaryrefslogtreecommitdiffstats
path: root/internal/notify/store_test.go
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-19 09:16:16 +0200
committerDanilo M. <danix@danix.xyz>2026-10-19 09:16:16 +0200
commit73d7aff4248a5ab05cec55dbd7feb0d17b97c1df (patch)
tree31f7c449033f87cf189566640655400f182fa140 /internal/notify/store_test.go
parent1e70e552db6790f2fd07fdd1721bf6cf76e0c6b3 (diff)
downloadnotifyd-73d7aff4248a5ab05cec55dbd7feb0d17b97c1df.tar.gz
notifyd-73d7aff4248a5ab05cec55dbd7feb0d17b97c1df.zip
feat(notify): make the queue and history caps settable
A lowered cap applies at the next add rather than at once, so reloading the config never drops a notification the user has not seen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/notify/store_test.go')
-rw-r--r--internal/notify/store_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/notify/store_test.go b/internal/notify/store_test.go
index 13f78dc..cc351be 100644
--- a/internal/notify/store_test.go
+++ b/internal/notify/store_test.go
@@ -164,3 +164,26 @@ func TestStoreRemovesImageOnReplace(t *testing.T) {
t.Fatalf("replace removed %v", removed)
}
}
+
+func TestSetCapsAppliesAtNextAdd(t *testing.T) {
+ s, _ := newTestStore()
+ for i := 0; i < 5; i++ {
+ id, _ := s.Add(popup("a"), "", 0)
+ s.Dismiss(id, 2)
+ }
+ for i := 0; i < 4; i++ {
+ s.Add(popup("a"), "", 0)
+ }
+ s.SetCaps(2, 3)
+ // Lowering a cap drops nothing by itself.
+ if got := len(s.historySnapshot()); got != 5 {
+ t.Fatalf("history after SetCaps = %d, want 5", got)
+ }
+ s.Add(popup("a"), "", 0)
+ if got := len(s.order); got != 2 {
+ t.Errorf("live = %d, want 2", got)
+ }
+ if got := len(s.historySnapshot()); got != 3 {
+ t.Errorf("history = %d, want 3", got)
+ }
+}