diff options
Diffstat (limited to 'internal/notify/store_test.go')
| -rw-r--r-- | internal/notify/store_test.go | 23 |
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) + } +} |
