package chat import ( "context" "testing" "chat-agent-system/internal/bizdev" "chat-agent-system/internal/config" "chat-agent-system/internal/coordinator" "chat-agent-system/internal/docgov" ) func TestExecuteAction_DocGovReviewApprove(t *testing.T) { cfg := &config.Config{DataDir: t.TempDir()} svc := bizdev.MustNewService(t, cfg) docGov := bizdev.Snapshot(svc).Gov ctx := context.Background() docID := "doc_proj1_research" _, err := docGov.CreateOrGetDocument( ctx, docID, 1, "research", "调研报告", "V0.5", "", 1, "张工", 2, "李主管", 3, "王总监", ) if err != nil { t.Fatalf("CreateOrGetDocument: %v", err) } _ = docGov.MarkDocumentContentUpdated(ctx, docID, "hash1", false) _, _ = docGov.SubmitForReview(ctx, docID, 1, docgov.RoleAuthor, "张工") sess := &Session{ UserID: 2, Actions: &ActionServices{DocGov: docGov}, } action := &coordinator.PendingAction{ Kind: "docgov.review_approve", DocID: docID, Comment: "同意", } userCtx := &coordinator.UserProjectContext{ User: coordinator.UserInfo{ID: "2", Name: "李主管"}, } result, err := sess.executeAction(ctx, action, userCtx) if err != nil { t.Fatalf("executeAction failed: %v", err) } if result.DocState != string(docgov.StateApproving) { t.Fatalf("expected approving state, got %s", result.DocState) } reply := renderActionReply(action, result, nil) if reply == "" { t.Fatal("expected non-empty reply") } }