package driveroot_test import ( "testing" "github.com/ultisuite/ulti-backend/internal/driveroot" "github.com/ultisuite/ulti-backend/internal/nextcloud" ) func TestGoogleWorkspaceWebURL(t *testing.T) { url := driveroot.GoogleWorkspaceWebURL("application/vnd.google-apps.document", "abc123") if url != "https://docs.google.com/document/d/abc123/edit" { t.Fatalf("unexpected url: %s", url) } } func TestEnrichMountCloudNativeGoogle(t *testing.T) { file := nextcloud.FileInfo{ Type: "file", Name: "Budget", MimeType: "application/vnd.google-apps.spreadsheet", ETag: "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms", } driveroot.EnrichMountCloudNative(&file, "googledrive") if !file.OpenExternally { t.Fatal("expected open_externally") } if file.ExternalURL == "" { t.Fatal("expected external_url") } if file.MountBackend != "google" { t.Fatalf("mount_backend=%s", file.MountBackend) } } func TestEnrichMountCloudNativePersonalIgnored(t *testing.T) { file := nextcloud.FileInfo{ Type: "file", Name: "Report.docx", MimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", } driveroot.EnrichMountCloudNative(&file, "googledrive") if file.OpenExternally { t.Fatal("personal ultidrive doc should not open externally from mount enrich without mount context") } } func TestEnrichMountCloudNativeMicrosoftOffice(t *testing.T) { file := nextcloud.FileInfo{ Type: "file", Name: "Plan.xlsx", MimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", } driveroot.EnrichMountCloudNative(&file, "onedrive") if !file.OpenExternally { t.Fatal("expected open_externally for office on onedrive mount") } if file.MountBackend != "microsoft" { t.Fatalf("mount_backend=%s", file.MountBackend) } }