7626a28de3
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
31 lines
880 B
Go
31 lines
880 B
Go
package fillwatch
|
|
|
|
import (
|
|
"io"
|
|
"log"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// `09` §3 decision 36 — the drive-full warning names the kept folders on that drive (and only there).
|
|
func TestFillwatch_ExtraSentenceRidesTheWarning(t *testing.T) {
|
|
var got []Event
|
|
w := New(filepath.Join(t.TempDir(), "s.json"), log.New(io.Discard, "", 0),
|
|
func() []Target { return []Target{{Path: "/mnt/d", Label: "HDD"}} },
|
|
func(string) *Usage { return &Usage{UsedPercent: 97, AvailGB: 3, UsedGB: 97, TotalGB: 100} })
|
|
w.SetNotify(func(e Event) { got = append(got, e) })
|
|
w.SetExtra(func(tg Target, _ string) string {
|
|
if tg.Path == "/mnt/d" {
|
|
return "KEPT: Nextcloud (126.0 MB)."
|
|
}
|
|
return ""
|
|
})
|
|
if err := w.Check(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(got) != 1 || !strings.HasSuffix(got[0].Message, " KEPT: Nextcloud (126.0 MB).") {
|
|
t.Fatalf("events = %+v", got)
|
|
}
|
|
}
|