Files
weichenandCursor 37b1aaa3ae feat(rdev): add medical design-control workflow (13 stages / 60 docs)
Seed rdev.v2.json, rd_ templates, catalog policy (order 40), squad
kind orchestration, and hard precheck requiring completed main (CDO).
Includes StageKey dynamicization from P0 and docs for P2–P4 skeleton.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 09:46:26 +00:00

44 lines
1.2 KiB
Go

package bizdev
import (
"context"
"errors"
"strings"
"testing"
"chat-agent-system/internal/projectworkflow"
)
func TestEnsureRDevMainCompleted_RejectsWhenMissing(t *testing.T) {
s := &Service{
completedMainHook: func(context.Context, int64) (bool, error) { return false, nil },
}
err := s.ensureRDevMainCompleted(context.Background(), 42)
if err == nil {
t.Fatal("expected prerequisite error")
}
if !errors.Is(err, projectworkflow.ErrPrerequisiteNotMet) {
t.Fatalf("want ErrPrerequisiteNotMet, got %v", err)
}
if !strings.Contains(err.Error(), "CDO") {
t.Fatalf("message missing CDO hint: %v", err)
}
}
func TestEnsureRDevMainCompleted_AllowsWhenCompleted(t *testing.T) {
s := &Service{
completedMainHook: func(context.Context, int64) (bool, error) { return true, nil },
}
if err := s.ensureRDevMainCompleted(context.Background(), 42); err != nil {
t.Fatal(err)
}
}
func TestResolveDocStage_SkipsMaturityForRD(t *testing.T) {
// rd_ tasks without StageKey fall back to V0.5 (not maturity labels); StageKey wins.
got := resolveDocStage(TaskRunRequest{TaskKey: "rd_proposal", StageKey: "RD01_planning"})
if got != "RD01_planning" {
t.Fatalf("got %q", got)
}
}