MCPcopy Index your code
hub / github.com/docker/docker-agent / TestWithPromptFiles

Function TestWithPromptFiles

pkg/teamloader/teamloader_test.go:500–544  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

498}
499
500func TestWithPromptFiles(t *testing.T) {
501 t.Setenv("OPENAI_API_KEY", "dummy")
502
503 tests := []struct {
504 name string
505 cliPromptFiles []string
506 expected []string
507 }{
508 {
509 name: "no CLI prompt files",
510 cliPromptFiles: nil,
511 expected: []string{}, // basic.yaml has no add_prompt_files
512 },
513 {
514 name: "single CLI prompt file",
515 cliPromptFiles: []string{"AGENTS.md"},
516 expected: []string{"AGENTS.md"},
517 },
518 {
519 name: "multiple CLI prompt files",
520 cliPromptFiles: []string{"AGENTS.md", "CLAUDE.md"},
521 expected: []string{"AGENTS.md", "CLAUDE.md"},
522 },
523 }
524
525 for _, tt := range tests {
526 t.Run(tt.name, func(t *testing.T) {
527 agentSource, err := config.Resolve("testdata/basic.yaml", nil)
528 require.NoError(t, err)
529
530 var opts []Opt
531 if len(tt.cliPromptFiles) > 0 {
532 opts = append(opts, WithPromptFiles(tt.cliPromptFiles))
533 }
534
535 team, err := Load(t.Context(), agentSource, &config.RuntimeConfig{}, withTestProviderRegistry(opts...)...)
536 require.NoError(t, err)
537
538 rootAgent, err := team.Agent("root")
539 require.NoError(t, err)
540
541 assert.Equal(t, tt.expected, rootAgent.AddPromptFiles())
542 })
543 }
544}
545
546func TestWithPromptFilesMergesWithConfig(t *testing.T) {
547 t.Setenv("OPENAI_API_KEY", "dummy")

Callers

nothing calls this directly

Calls 8

ResolveFunction · 0.92
WithPromptFilesFunction · 0.85
withTestProviderRegistryFunction · 0.85
ContextMethod · 0.80
AgentMethod · 0.80
AddPromptFilesMethod · 0.80
LoadFunction · 0.70
RunMethod · 0.65

Tested by

no test coverage detected