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

Function TestPromptBuilder_Basic

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

Source from the content-addressed store, hash-verified

14)
15
16func TestPromptBuilder_Basic(t *testing.T) {
17 deps := setupPromptTestDeps(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 // 获取 System Prompt
39 systemPrompt := ag.GetSystemPrompt()
40
41 // 验证基础 Prompt 存在
42 if !strings.Contains(systemPrompt, "You are a test assistant") {
43 t.Error("System prompt should contain base prompt")
44 }
45
46 // 验证环境信息存在
47 if !strings.Contains(systemPrompt, "## Environment Information") {
48 t.Error("System prompt should contain environment information")
49 }
50
51 // 验证工具手册存在
52 if !strings.Contains(systemPrompt, "## Tools Manual") {
53 t.Error("System prompt should contain tools manual")
54 }
55
56 t.Logf("System Prompt length: %d", len(systemPrompt))
57}
58
59func TestPromptBuilder_CodeAssistant(t *testing.T) {
60 deps := setupPromptTestDeps(t)

Callers

nothing calls this directly

Calls 5

setupPromptTestDepsFunction · 0.85
CreateFunction · 0.85
CloseMethod · 0.65
GetSystemPromptMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected