22 lines
642 B
Go
22 lines
642 B
Go
package nextcloud
|
|
|
|
import "testing"
|
|
|
|
func TestFilterHiddenUltidocSidecars(t *testing.T) {
|
|
files := []FileInfo{
|
|
{Path: "/docs/report.docx", Name: "report.docx", Type: "file"},
|
|
{Path: "/docs/report.ultidoc.json", Name: "report.ultidoc.json", Type: "file"},
|
|
{Path: "/solo.ultidoc.json", Name: "solo.ultidoc.json", Type: "file"},
|
|
{Path: "/docs", Name: "docs", Type: "directory"},
|
|
}
|
|
out := FilterHiddenUltidocSidecars(files)
|
|
if len(out) != 3 {
|
|
t.Fatalf("len(out) = %d, want 3", len(out))
|
|
}
|
|
for _, f := range out {
|
|
if f.Name == "report.ultidoc.json" {
|
|
t.Fatal("sidecar should be hidden when source exists in listing")
|
|
}
|
|
}
|
|
}
|