Files
Agent-System/internal/bizdev/test_manager_flow_test.go
T
weichenandCursor 3f42149457 feat(bizdev): snapshot collaborators onto Runtime and Server ports
Composition roots copy Parts once so HTTP/CLI handlers stop calling locator getters on every request.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 13:00:33 +00:00

49 lines
1.4 KiB
Go

package bizdev
import (
"context"
"testing"
"time"
"chat-agent-system/internal/config"
)
func TestExecuteTask_TestManagerAfterApprovedUpstream(t *testing.T) {
svc := MustNewService(t, &config.Config{DataDir: t.TempDir(), AgentBackend: "stub"})
ctx := context.Background()
srDocID := "doc_proj1001_system_reqs"
_, err := svc.docGov.CreateOrGetDocument(
ctx, srDocID, 1001, "system_reqs", "系统需求规格书", "V0.5", "",
2, "张工", 3, "李主管", 4, "王总监",
)
if err != nil {
t.Fatalf("CreateOrGetDocument: %v", err)
}
_ = svc.docGov.MarkDocumentContentUpdated(ctx, srDocID, "hash_v1", false)
_, _ = svc.docGov.SubmitForReview(ctx, srDocID, 2, "author", "张工")
_, _ = svc.docGov.ReviewApprove(ctx, srDocID, 3, "reviewer", "李主管", "同意")
_, err = svc.docGov.ApproverApprove(ctx, srDocID, 4, "approver", "王总监", "批准")
if err != nil {
t.Fatalf("ApproverApprove: %v", err)
}
res, err := svc.ExecuteTask(ctx, TaskRunRequest{
TaskKey: "test_manager",
ProjectID: 1001,
ProjectName: "智能肺功能仪",
Backend: "stub",
Timeout: 30 * time.Second,
UserID: 2,
Materials: []MaterialInput{{
Filename: "upstream_system_requirements.md",
Content: []byte("# 系统需求\n| REQ-01 | 测量流量误差 <= 3% | 测试 | 高 |\n"),
}},
})
if err != nil {
t.Fatalf("ExecuteTask error: %v reason=%s", err, res.ErrorReason)
}
if res == nil {
t.Fatal("expected task result")
}
}