Release Please / Release Please (push) Skipped
Release / GoReleaser (push) Skipped
Tests / Secret scan (gitleaks) (push) Skipped
Tests / Test (Go 1.25) (push) Skipped
Tests / Test (Go stable) (push) Skipped
Tests / Secret scan (gitleaks) (pull_request) Successful in 5s
Tests / Test (Go 1.25) (pull_request) Successful in 1m16s
Tests / Test (Go stable) (pull_request) Successful in 1m36s
Promote the generic, reusable parts of the private oo-workspace into the public library/CLI, so oo-workspace can shrink to business glue. - board.go: Board types + (c *Client) SyncBoard — upsert project milestones/tasks by exact title from a YAML board (dry-run when apply=false). CLI: oo projects board-sync. - crm_audit.go: OpportunityAudit + (c *Client) AuditOpportunities — file/task/member counts with a generic class (ok|dup|empty|junk-title). CLI: oo crm audit [--out]. - catalog/names.go: CleanPersonNames / GuessNameFromEmail / FormatProjectTitle (ported from oo-workspace). - catalog: adopt the newer apply/match logic — name repair (never encode company in lastName), company grouping key, contact-info type normalization, preserve an already-applied oo_id. Keeps the local Address/OOProjects fields and the config-driven classifier. Business-only oo-workspace commands (crm clean/migrate, folders, search) deliberately stay private.
37 lines
978 B
Go
37 lines
978 B
Go
package onlyoffice
|
|
|
|
import "testing"
|
|
|
|
func TestAuditID(t *testing.T) {
|
|
cases := []struct {
|
|
in any
|
|
want int64
|
|
}{
|
|
{float64(12), 12},
|
|
{7, 7},
|
|
{int64(9), 9},
|
|
{"42", 42},
|
|
{nil, 0},
|
|
}
|
|
for _, c := range cases {
|
|
if got := auditID(c.in); got != c.want {
|
|
t.Fatalf("auditID(%v) = %d, want %d", c.in, got, c.want)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestTaskCountsByOpportunity(t *testing.T) {
|
|
open, closed := taskCountsByOpportunity([]map[string]any{
|
|
{"id": 1, "status": 1, "entity": map[string]any{"entityType": "opportunity", "entityId": 10}},
|
|
{"id": 2, "status": "2", "entity": map[string]any{"entityType": "opportunity", "entityId": 10}},
|
|
{"id": 3, "status": 1, "entity": map[string]any{"entityType": "contact", "entityId": 10}},
|
|
{"id": 4, "entity": "not-a-map"},
|
|
})
|
|
if open["10"] != 1 || closed["10"] != 1 {
|
|
t.Fatalf("open=%v closed=%v", open, closed)
|
|
}
|
|
if len(open) != 1 || len(closed) != 1 {
|
|
t.Fatalf("unexpected buckets: open=%v closed=%v", open, closed)
|
|
}
|
|
}
|