MCPcopy Create free account
hub / github.com/InferCore/InferCore / TestAdapter_InvokeAndMetadata

Function TestAdapter_InvokeAndMetadata

internal/adapters/mock/mock_test.go:11–35  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestAdapter_InvokeAndMetadata(t *testing.T) {
12 a := New(config.BackendConfig{
13 Name: "m",
14 Type: "mock",
15 Capabilities: []string{"chat"},
16 Cost: config.CostConfig{Unit: 1},
17 })
18 resp, err := a.Invoke(context.Background(), types.BackendRequest{
19 AIRequest: types.AIRequest{Input: map[string]any{"text": "ping"}},
20 })
21 if err != nil {
22 t.Fatal(err)
23 }
24 txt, _ := resp.Output["text"].(string)
25 if txt == "" {
26 t.Fatal("empty text")
27 }
28 if err := a.Health(context.Background()); err != nil {
29 t.Fatal(err)
30 }
31 md := a.Metadata()
32 if md.Name != "m" || md.Type != "mock" {
33 t.Fatalf("%+v", md)
34 }
35}

Callers

nothing calls this directly

Calls 4

NewFunction · 0.70
InvokeMethod · 0.65
HealthMethod · 0.65
MetadataMethod · 0.65

Tested by

no test coverage detected