MCPcopy
hub / github.com/dosco/graphjin / TestCollisionWithExistingResolverWarns

Function TestCollisionWithExistingResolverWarns

core/openapi_bridge_test.go:237–258  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

235}
236
237func TestCollisionWithExistingResolverWarns(t *testing.T) {
238 conf := &Config{
239 Resolvers: []ResolverConfig{
240 {Name: "ledger", Type: "remote_api", Table: "accounts", Column: "id"},
241 },
242 }
243 gj, logBuf := newTestEngineWithTables(t, conf, "public", "accounts")
244 synth := []ResolverConfig{
245 {
246 Name: "ledger", // matches existing resolver name
247 Type: "openapi",
248 Table: "accounts", Column: "id",
249 Props: ResolverProps{"spec_key": "fin", "operation_id": "getLedger"},
250 },
251 }
252 if err := gj.validateOpenAPINoCollisions(synth); err != nil {
253 t.Fatalf("existing-resolver collision should warn, not error; got: %v", err)
254 }
255 if !strings.Contains(logBuf.String(), "fin/getLedger") {
256 t.Errorf("expected warning identifying the operation; got log: %q", logBuf.String())
257 }
258}
259
260func TestNoCollisionsHappyPath(t *testing.T) {
261 gj, logBuf := newTestEngineWithTables(t, &Config{}, "public", "users", "orders")

Callers

nothing calls this directly

Calls 3

newTestEngineWithTablesFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected