TestRegisterWorkflow 测试注册 Workflow
(t *testing.T)
| 199 | |
| 200 | // TestRegisterWorkflow 测试注册 Workflow |
| 201 | func TestRegisterWorkflow(t *testing.T) { |
| 202 | deps := createTestDependencies(t) |
| 203 | pool := core.NewPool(&core.PoolOptions{ |
| 204 | Dependencies: deps, |
| 205 | MaxAgents: 5, |
| 206 | }) |
| 207 | |
| 208 | os, err := New(&Options{ |
| 209 | Name: "TestOS", |
| 210 | Port: 8080, |
| 211 | Pool: pool, |
| 212 | }) |
| 213 | if err != nil { |
| 214 | t.Fatalf("Failed to create AsterOS: %v", err) |
| 215 | } |
| 216 | |
| 217 | // 创建 Workflow |
| 218 | workflowInstance := &workflow.SequentialAgent{} |
| 219 | |
| 220 | // 注册 Workflow |
| 221 | err = os.RegisterWorkflow("test-workflow", workflowInstance) |
| 222 | if err != nil { |
| 223 | t.Fatalf("Failed to register workflow: %v", err) |
| 224 | } |
| 225 | |
| 226 | // 验证 Workflow 已注册 |
| 227 | _, exists := os.Registry().GetWorkflow("test-workflow") |
| 228 | if !exists { |
| 229 | t.Error("Workflow not found in registry") |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | // TestAddInterface 测试添加 Interface |
| 234 | func TestAddInterface(t *testing.T) { |
nothing calls this directly
no test coverage detected