MCPcopy Create free account
hub / github.com/github/copilot-sdk / TestListModelsHandlerCachesResults

Function TestListModelsHandlerCachesResults

go/client_test.go:1303–1328  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1301}
1302
1303func TestListModelsHandlerCachesResults(t *testing.T) {
1304 customModels := []ModelInfo{
1305 {
1306 ID: "cached-model",
1307 Name: "Cached Model",
1308 Capabilities: ModelCapabilities{
1309 Supports: ModelSupports{Vision: false, ReasoningEffort: false},
1310 Limits: ModelLimits{MaxContextWindowTokens: Int(128000)},
1311 },
1312 },
1313 }
1314
1315 callCount := 0
1316 handler := func(ctx context.Context) ([]ModelInfo, error) {
1317 callCount++
1318 return customModels, nil
1319 }
1320
1321 client := NewClient(&ClientOptions{OnListModels: handler})
1322
1323 _, _ = client.ListModels(t.Context())
1324 _, _ = client.ListModels(t.Context())
1325 if callCount != 1 {
1326 t.Errorf("expected handler called once due to caching, got %d", callCount)
1327 }
1328}
1329
1330func TestClient_StartContextCancellationDoesNotKillProcess(t *testing.T) {
1331 cliPath := findCLIPathForTest()

Callers

nothing calls this directly

Calls 3

ListModelsMethod · 0.95
IntFunction · 0.85
NewClientFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…