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) {
|
if resp.Parent != filepath.Dir(dir) {
|
||||||
t.Errorf("parent = %q, want %q", resp.Parent, filepath.Dir(dir))
|
t.Errorf("parent = %q, want %q", resp.Parent, filepath.Dir(dir))
|
||||||
}
|
}
|
||||||
var names []string
|
if resp.Dir != dir {
|
||||||
for _, e := range resp.Entries {
|
t.Errorf("dir = %q, want %q", resp.Dir, dir)
|
||||||
names = append(names, e.Name)
|
|
||||||
}
|
}
|
||||||
|
var names []string
|
||||||
hasSub, hasMd, hasTxt := false, false, false
|
hasSub, hasMd, hasTxt := false, false, false
|
||||||
for _, e := range resp.Entries {
|
for _, e := range resp.Entries {
|
||||||
|
names = append(names, e.Name)
|
||||||
switch e.Name {
|
switch e.Name {
|
||||||
case "sub":
|
case "sub":
|
||||||
hasSub = e.IsDir
|
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":
|
case "profile.md":
|
||||||
hasMd = !e.IsDir
|
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":
|
case "notes.txt":
|
||||||
hasTxt = true
|
hasTxt = true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user