(t *testing.T)
| 103 | } |
| 104 | |
| 105 | func TestKnowledgePlugin_Validation(t *testing.T) { |
| 106 | withFakeKnowledgeAdapter(t) |
| 107 | p := NewBuiltinKnowledgePlugin() |
| 108 | |
| 109 | if _, err := p.Execute(context.Background(), []string{`{"cmd":"search","args":{}}`}); err == nil || |
| 110 | !strings.Contains(err.Error(), `"query" is required`) { |
| 111 | t.Errorf("search without query must error, got %v", err) |
| 112 | } |
| 113 | if _, err := p.Execute(context.Background(), []string{`{"cmd":"get","args":{}}`}); err == nil || |
| 114 | !strings.Contains(err.Error(), `"source" is required`) { |
| 115 | t.Errorf("get without source must error, got %v", err) |
| 116 | } |
| 117 | if _, err := p.Execute(context.Background(), []string{`{"cmd":"bogus"}`}); err == nil || |
| 118 | !strings.Contains(err.Error(), "unknown cmd") { |
| 119 | t.Errorf("unknown cmd must error, got %v", err) |
| 120 | } |
| 121 | if _, err := p.Execute(context.Background(), nil); err == nil { |
| 122 | t.Error("empty args must error with an example") |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | func TestKnowledgePlugin_Metadata(t *testing.T) { |
| 127 | p := NewBuiltinKnowledgePlugin() |
nothing calls this directly
no test coverage detected