29 lines
715 B
Go
29 lines
715 B
Go
package nextcloud
|
|
|
|
import "testing"
|
|
|
|
func TestSidecarPathForSource(t *testing.T) {
|
|
tests := []struct {
|
|
source string
|
|
sidecar string
|
|
}{
|
|
{"/docs/report.docx", "/docs/report.ultidoc.json"},
|
|
{"docs/report.docx", "/docs/report.ultidoc.json"},
|
|
{"/report.docx", "/report.ultidoc.json"},
|
|
}
|
|
for _, tt := range tests {
|
|
if got := SidecarPathForSource(tt.source); got != tt.sidecar {
|
|
t.Fatalf("SidecarPathForSource(%q) = %q, want %q", tt.source, got, tt.sidecar)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestIsUltidocSidecarPath(t *testing.T) {
|
|
if !IsUltidocSidecarPath("/docs/report.ultidoc.json") {
|
|
t.Fatal("expected sidecar path")
|
|
}
|
|
if IsUltidocSidecarPath("/docs/report.docx") {
|
|
t.Fatal("docx is not a sidecar path")
|
|
}
|
|
}
|