From acf336c846e136d3f40ef7350254a8e0ae6d4a59 Mon Sep 17 00:00:00 2001 From: Felix Martin Date: Mon, 1 Jun 2026 20:16:36 -0400 Subject: [PATCH] Strengthen /fs/browse test: assert dir and entry paths Co-Authored-By: Claude Opus 4.8 --- internal/web/settings_handlers_test.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/internal/web/settings_handlers_test.go b/internal/web/settings_handlers_test.go index 0d02db2..a757897 100644 --- a/internal/web/settings_handlers_test.go +++ b/internal/web/settings_handlers_test.go @@ -148,17 +148,24 @@ func TestBrowseListsDirsAndMarkdown(t *testing.T) { if resp.Parent != filepath.Dir(dir) { t.Errorf("parent = %q, want %q", resp.Parent, filepath.Dir(dir)) } - var names []string - for _, e := range resp.Entries { - names = append(names, e.Name) + if resp.Dir != dir { + t.Errorf("dir = %q, want %q", resp.Dir, dir) } + var names []string hasSub, hasMd, hasTxt := false, false, false for _, e := range resp.Entries { + names = append(names, e.Name) switch e.Name { case "sub": hasSub = e.IsDir + if e.Path != filepath.Join(dir, e.Name) { + t.Errorf("sub path = %q, want %q", e.Path, filepath.Join(dir, e.Name)) + } case "profile.md": hasMd = !e.IsDir + if e.Path != filepath.Join(dir, e.Name) { + t.Errorf("profile.md path = %q, want %q", e.Path, filepath.Join(dir, e.Name)) + } case "notes.txt": hasTxt = true }