MCPcopy Index your code
hub / github.com/github/copilot-sdk / TestListModelsWithCustomHandler

Function TestListModelsWithCustomHandler

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

Source from the content-addressed store, hash-verified

1197}
1198
1199func TestListModelsWithCustomHandler(t *testing.T) {
1200 customModels := []ModelInfo{
1201 {
1202 ID: "my-custom-model",
1203 Name: "My Custom Model",
1204 Capabilities: ModelCapabilities{
1205 Supports: ModelSupports{Vision: false, ReasoningEffort: false},
1206 Limits: ModelLimits{MaxContextWindowTokens: Int(128000)},
1207 },
1208 },
1209 }
1210
1211 callCount := 0
1212 handler := func(ctx context.Context) ([]ModelInfo, error) {
1213 callCount++
1214 return customModels, nil
1215 }
1216
1217 client := NewClient(&ClientOptions{OnListModels: handler})
1218
1219 models, err := client.ListModels(t.Context())
1220 if err != nil {
1221 t.Fatalf("ListModels failed: %v", err)
1222 }
1223 if callCount != 1 {
1224 t.Errorf("expected handler called once, got %d", callCount)
1225 }
1226 if len(models) != 1 || models[0].ID != "my-custom-model" {
1227 t.Errorf("unexpected models: %+v", models)
1228 }
1229}
1230
1231func TestModelBillingTokenPricesJSON(t *testing.T) {
1232 int64Ptr := func(v int64) *int64 {

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…