aboutsummaryrefslogtreecommitdiffstats
path: root/internal/notify/files_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/notify/files_test.go')
-rw-r--r--internal/notify/files_test.go17
1 files changed, 17 insertions, 0 deletions
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)
+ }
+}