37 lines
818 B
Go
37 lines
818 B
Go
package workflow
|
|
|
|
import "testing"
|
|
|
|
func TestCanTransition(t *testing.T) {
|
|
if !CanTransition(StagePlan, StageReview) {
|
|
t.Fatal("expected plan -> review to be allowed")
|
|
}
|
|
if CanTransition(StageVerification, StagePlan) {
|
|
t.Fatal("expected verification -> plan to be disallowed")
|
|
}
|
|
}
|
|
|
|
func TestRunValidateRejectsInvalidStatus(t *testing.T) {
|
|
run := Run{
|
|
WorkspaceID: "ws_1",
|
|
TopicID: "topic_1",
|
|
RoleName: "backend",
|
|
Stage: StageExecution,
|
|
Status: RunStatus("broken"),
|
|
}
|
|
if err := run.Validate(); err == nil {
|
|
t.Fatal("Validate() expected invalid status error")
|
|
}
|
|
}
|
|
|
|
func TestRunLogValidate(t *testing.T) {
|
|
log := RunLog{
|
|
RunID: "run_1",
|
|
Stream: LogStreamStdout,
|
|
Content: "hello",
|
|
}
|
|
if err := log.Validate(); err != nil {
|
|
t.Fatalf("Validate() error = %v", err)
|
|
}
|
|
}
|