MCPcopy Create free account
hub / github.com/astercloud/aster / TestAddStep

Function TestAddStep

pkg/executionplan/types_test.go:46–91  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

44}
45
46func TestAddStep(t *testing.T) {
47 plan := NewExecutionPlan("Test plan")
48
49 step := plan.AddStep("test_tool", "Test step description", map[string]any{
50 "param1": "value1",
51 "param2": 42,
52 })
53
54 if step == nil {
55 t.Fatal("AddStep returned nil")
56 }
57
58 if len(plan.Steps) != 1 {
59 t.Errorf("expected 1 step, got %d", len(plan.Steps))
60 }
61
62 if step.ToolName != "test_tool" {
63 t.Errorf("expected tool name %q, got %q", "test_tool", step.ToolName)
64 }
65
66 if step.Description != "Test step description" {
67 t.Errorf("expected description %q, got %q", "Test step description", step.Description)
68 }
69
70 if step.Index != 0 {
71 t.Errorf("expected index 0, got %d", step.Index)
72 }
73
74 if step.Status != StepStatusPending {
75 t.Errorf("expected status %v, got %v", StepStatusPending, step.Status)
76 }
77
78 if step.Parameters["param1"] != "value1" {
79 t.Errorf("expected param1 to be 'value1', got %v", step.Parameters["param1"])
80 }
81
82 // Add second step
83 step2 := plan.AddStep("another_tool", "Another step", nil)
84 if step2.Index != 1 {
85 t.Errorf("expected second step index 1, got %d", step2.Index)
86 }
87
88 if len(plan.Steps) != 2 {
89 t.Errorf("expected 2 steps, got %d", len(plan.Steps))
90 }
91}
92
93func TestGetStep(t *testing.T) {
94 plan := NewExecutionPlan("Test plan")

Callers

nothing calls this directly

Calls 2

AddStepMethod · 0.95
NewExecutionPlanFunction · 0.85

Tested by

no test coverage detected