MCPcopy Create free account
hub / github.com/github/gh-aw / TestComputeToolCallsDiff_NewTools

Function TestComputeToolCallsDiff_NewTools

pkg/cli/audit_diff_test.go:1118–1150  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1116}
1117
1118func TestComputeToolCallsDiff_NewTools(t *testing.T) {
1119 m1 := &LogMetrics{
1120 ToolCalls: []ToolCallInfo{
1121 {Name: "gh", CallCount: 5},
1122 },
1123 }
1124 m2 := &LogMetrics{
1125 ToolCalls: []ToolCallInfo{
1126 {Name: "gh", CallCount: 5},
1127 {Name: "bash", CallCount: 3, MaxInputSize: 200, MaxOutputSize: 500},
1128 {Name: "edit", CallCount: 2},
1129 },
1130 }
1131
1132 diff := computeToolCallsDiff(m1, m2)
1133 require.NotNil(t, diff, "Should produce diff when tool calls exist")
1134
1135 assert.Len(t, diff.NewTools, 2, "Should have 2 new tools (bash, edit)")
1136 assert.Empty(t, diff.RemovedTools, "Should have no removed tools")
1137 assert.Empty(t, diff.ChangedTools, "Should have no changed tools")
1138 assert.Len(t, diff.AllTools, 3, "AllTools should include all 3 tools")
1139
1140 bashEntry := findToolCallDiffEntry(diff.NewTools, "bash")
1141 require.NotNil(t, bashEntry, "Should find bash in new tools")
1142 assert.Equal(t, "new", bashEntry.Status, "bash status should be 'new'")
1143 assert.Equal(t, 3, bashEntry.Run2CallCount, "bash call count should be 3")
1144 assert.Equal(t, 200, bashEntry.Run2MaxInputSize, "bash max input should be 200")
1145 assert.Equal(t, 500, bashEntry.Run2MaxOutputSize, "bash max output should be 500")
1146
1147 assert.Equal(t, 2, diff.Summary.NewToolCount, "Summary should show 2 new tools")
1148 assert.Equal(t, 5, diff.Summary.Run1TotalCalls, "Run1 total should be 5")
1149 assert.Equal(t, 10, diff.Summary.Run2TotalCalls, "Run2 total should be 10 (5+3+2)")
1150}
1151
1152func TestComputeToolCallsDiff_RemovedTools(t *testing.T) {
1153 m1 := &LogMetrics{

Callers

nothing calls this directly

Calls 2

computeToolCallsDiffFunction · 0.85
findToolCallDiffEntryFunction · 0.85

Tested by

no test coverage detected