Strengthen /fs/browse test: assert dir and entry paths
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user