From 3b8a0e0f4a5c28394ac578e8559bf57ae82d3fd2 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 15 Sep 2026 17:59:35 +0200 Subject: feat(notify): add the image field and its cleanup Popup gains image, and the store calls an injected removeImage when an entry is dismissed, evicted, replaced or expired, so a daemon-written PNG does not outlive its balloon. The service decides what is daemon-owned; the store only names the path. NewStore now takes the callback as a third parameter, so the service wires its removeImage in (unlinking only under ImagesDir) and the existing call sites pass nil. --- internal/notify/files_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'internal/notify/files_test.go') diff --git a/internal/notify/files_test.go b/internal/notify/files_test.go index b17a4f6..606b131 100644 --- a/internal/notify/files_test.go +++ b/internal/notify/files_test.go @@ -55,3 +55,20 @@ func TestPublishEmptyIsAnEmptyArray(t *testing.T) { t.Errorf("empty queue encoded as %q, want []", data) } } + +func TestWriteImage(t *testing.T) { + dir := t.TempDir() + p, err := WriteImage(dir, 7, []byte("png-bytes")) + if err != nil { + t.Fatal(err) + } + if filepath.Base(p) != "7.png" { + t.Fatalf("path %q", p) + } + if b, _ := os.ReadFile(p); string(b) != "png-bytes" { + t.Fatalf("contents %q", b) + } + if got := ImagesDir(dir); got != filepath.Join(dir, "img") { + t.Fatalf("ImagesDir %q", got) + } +} -- cgit v1.2.3