ultisuite-backend/internal/api/drive/ultidoc_sidecar_test.go
R3D347HR4Y 0466a1c169
Some checks are pending
CI / Go tests (push) Waiting to run
CI / Integration tests (push) Waiting to run
CI / DB migrations (push) Waiting to run
wow
2026-06-11 01:22:52 +02:00

32 lines
874 B
Go

package drive
import (
"testing"
"github.com/ultisuite/ulti-backend/internal/nextcloud"
)
func TestSidecarPathsForSourceMove(t *testing.T) {
src, dest, ok := sidecarPathsForSourceMove("/docs/a.docx", "/archive/a.docx")
if !ok {
t.Fatal("expected sidecar sync for docx")
}
if src != "/docs/a.ultidoc.json" || dest != "/archive/a.ultidoc.json" {
t.Fatalf("unexpected sidecar paths: %q -> %q", src, dest)
}
_, _, ok = sidecarPathsForSourceMove("/docs/a.ultidoc.json", "/archive/a.ultidoc.json")
if ok {
t.Fatal("ultidoc sidecar itself should not trigger companion sync")
}
}
func TestShouldSyncUltidocSidecar(t *testing.T) {
if !shouldSyncUltidocSidecar("/docs/report.docx") {
t.Fatal("docx should sync sidecar")
}
if shouldSyncUltidocSidecar(nextcloud.SidecarPathForSource("/docs/report.docx")) {
t.Fatal("sidecar path should not sync again")
}
}