自检豁免改为同行且须 meta+否定紧邻或引号引用,避免正文「无」误放过;buildBizdevStageRequest 单测锁住身份/职责字段与 AutoRepair 契约。 Co-authored-by: Cursor <cursoragent@cursor.com>
48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
package server
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"chat-agent-system/internal/bizdev"
|
|
)
|
|
|
|
func TestBuildBizdevStageRequest_PreservesIdentityAndRoles(t *testing.T) {
|
|
s := &Server{}
|
|
dto := TaskRunRequestDTO{
|
|
Stage: "v0.5_feasibility",
|
|
ProjectName: "P",
|
|
CustomerName: "C",
|
|
DeviceType: "D",
|
|
IntendedUse: "U",
|
|
TargetMarket: "M",
|
|
Backend: "stub",
|
|
AutoRepair: false,
|
|
UserID: 107,
|
|
ProjectID: 6098,
|
|
DocID: "doc_proj6098_intake",
|
|
AuthorID: 1,
|
|
AuthorName: "编制人",
|
|
ReviewerID: 2,
|
|
ReviewerName: "审核人",
|
|
ApproverID: 3,
|
|
ApproverName: "批准人",
|
|
ForceDirectEdit: true,
|
|
}
|
|
got := s.buildBizdevStageRequest(dto, "sess-p6098-u107", "turn_x", "run_y")
|
|
if !got.AutoRepair {
|
|
t.Fatal("product contract: AutoRepair must be forced true")
|
|
}
|
|
if got.SessionID != "sess-p6098-u107" || got.ClientTurnID != "turn_x" || got.RunID != "run_y" {
|
|
t.Fatalf("session/turn/run dropped: %+v", got)
|
|
}
|
|
if got.UserID != 107 || got.ProjectID != 6098 || got.DocID != "doc_proj6098_intake" {
|
|
t.Fatalf("identity fields dropped: %+v", got)
|
|
}
|
|
if got.AuthorID != 1 || got.ReviewerID != 2 || got.ApproverID != 3 || !got.ForceDirectEdit {
|
|
t.Fatalf("role fields dropped: %+v", got)
|
|
}
|
|
if got.Stage != bizdev.MaturityStage("v0.5_feasibility") {
|
|
t.Fatalf("stage=%q", got.Stage)
|
|
}
|
|
}
|