package main import ( "encoding/json" "maps" "slices" "strings" "testing" "github.com/stretchr/testify/require" ) func TestPromptNamesTheAgent(t *testing.T) { text := prompt("Ada") require.Contains(t, text, "You are Ada, an AI agent") require.Contains(t, text, "- reply: Ada's replies") require.Contains(t, text, "Goal: let Ada work later") require.Contains(t, text, `- work: an agent's report, starting "[Name]"`) require.NotContains(t, text, promptName) // The old agent name is built from parts, so the source does not spell // it. require.NotContains(t, strings.ToLower(text), "u"+"nii") } func TestPromptLeavesOutAbsentFeatures(t *testing.T) { text := prompt("Ada") for _, absent := range []string{"image", "ubagent", "computer", "device", `zoom("Name")`, "instructions at the end"} { require.NotContains(t, text, absent) } } func TestAgentToolsAreStrictAndStable(t *testing.T) { tools := agentTools() require.Equal(t, []string{"zoom", "date"}, []string{tools[0].Name, tools[1].Name}) for _, tool := range tools { schema := tool.Parameters.(map[string]any) properties := schema["properties"].(map[string]any) require.True(t, tool.Strict, tool.Name) require.Equal(t, false, schema["additionalProperties"], tool.Name) require.Equal(t, slices.Sorted(maps.Keys(properties)), schema["required"], tool.Name) } first, err := json.Marshal(tools) require.NoError(t, err) for range 10 { again, err := json.Marshal(agentTools()) require.NoError(t, err) require.Equal(t, first, again) } }