| 26 | } |
| 27 | |
| 28 | func TestChainAddStep(t *testing.T) { |
| 29 | chain := NewChain(ChainConfig{MaxSteps: 3}) |
| 30 | |
| 31 | step := Step{ |
| 32 | Title: "Test Step", |
| 33 | Action: "Test Action", |
| 34 | Confidence: 0.9, |
| 35 | Status: StepStatusCompleted, |
| 36 | NextAction: NextActionContinue, |
| 37 | } |
| 38 | |
| 39 | err := chain.AddStep(step) |
| 40 | if err != nil { |
| 41 | t.Fatalf("failed to add step: %v", err) |
| 42 | } |
| 43 | |
| 44 | if len(chain.Steps) != 1 { |
| 45 | t.Errorf("expected 1 step, got %d", len(chain.Steps)) |
| 46 | } |
| 47 | |
| 48 | if chain.Steps[0].ID == "" { |
| 49 | t.Error("step ID should not be empty") |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | func TestChainMaxSteps(t *testing.T) { |
| 54 | chain := NewChain(ChainConfig{MaxSteps: 2}) |