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

Function TestAgentCreate

pkg/agent/agent_test.go:16–45  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func TestAgentCreate(t *testing.T) {
17 deps := setupTestDeps(t)
18
19 config := &types.AgentConfig{
20 TemplateID: "test-template",
21 ModelConfig: &types.ModelConfig{
22 Provider: "anthropic",
23 Model: "claude-sonnet-4-5",
24 APIKey: "test-key",
25 },
26 Sandbox: &types.SandboxConfig{
27 Kind: types.SandboxKindMock,
28 WorkDir: "/tmp/test",
29 },
30 }
31
32 ag, err := Create(context.Background(), config, deps)
33 if err != nil {
34 t.Fatalf("Failed to create agent: %v", err)
35 }
36 defer func() { _ = ag.Close() }()
37
38 if ag.ID() == "" {
39 t.Error("Agent ID should not be empty")
40 }
41
42 if ag.state != types.AgentStateReady {
43 t.Errorf("Expected state Ready, got %s", ag.state)
44 }
45}
46
47func TestAgentStatus(t *testing.T) {
48 deps := setupTestDeps(t)

Callers

nothing calls this directly

Calls 5

setupTestDepsFunction · 0.85
CreateFunction · 0.85
CloseMethod · 0.65
IDMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected