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

Function TestBuildTranscript

pkg/evaluation/eval_test.go:728–873  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

726}
727
728func TestBuildTranscript(t *testing.T) {
729 t.Parallel()
730
731 tests := []struct {
732 name string
733 events []map[string]any
734 wantContains []string
735 wantOrder []string // substrings that must appear in this order
736 }{
737 {
738 name: "empty events",
739 events: []map[string]any{},
740 wantContains: nil,
741 },
742 {
743 name: "text before tool call",
744 events: []map[string]any{
745 {"type": "agent_choice", "content": "I'll search for that.", "agent_name": "root"},
746 {
747 "type": "tool_call",
748 "agent_name": "root",
749 "tool_call": map[string]any{
750 "function": map[string]any{
751 "name": "search",
752 "arguments": `{"query": "test"}`,
753 },
754 },
755 },
756 },
757 wantContains: []string{
758 "[Agent root says]",
759 "I'll search for that.",
760 `[Agent root calls tool "search" with arguments:`,
761 },
762 wantOrder: []string{"I'll search for that.", "calls tool"},
763 },
764 {
765 name: "tool call before text (wrong order)",
766 events: []map[string]any{
767 {
768 "type": "tool_call",
769 "agent_name": "Coding agent",
770 "tool_call": map[string]any{
771 "function": map[string]any{
772 "name": "shell",
773 "arguments": `{"cmd": "ls"}`,
774 },
775 },
776 },
777 {"type": "agent_choice", "content": "I ran the command.", "agent_name": "Coding agent"},
778 },
779 wantContains: []string{
780 `[Agent Coding agent calls tool "shell" with arguments:`,
781 "[Agent Coding agent says]",
782 "I ran the command.",
783 },
784 wantOrder: []string{"calls tool", "I ran the command."},
785 },

Callers

nothing calls this directly

Calls 2

buildTranscriptFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected