testing filetree

This commit is contained in:
Bel LaPointe
2019-11-21 13:26:07 -07:00
parent a140d0eade
commit c88fed0929
3 changed files with 83 additions and 0 deletions

View File

@@ -1 +1,30 @@
package filetree
import (
"strings"
"testing"
)
func TestPaths(t *testing.T) {
paths := Paths([]Path{
NewPathFromURL("/notes/a/b"),
NewPathFromURL("/notes/c/d"),
NewPathFromURL("/notes/e/f"),
})
list := paths.List()
if strings.Count(list, "<li>") != 3 {
t.Error(list)
}
if !strings.Contains(list, ">f") {
t.Error(list)
}
list = paths.List(true)
if strings.Count(list, "<li>") != 3 {
t.Error(list)
}
if !strings.Contains(list, ">/notes/a") {
t.Error(list)
}
}