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

Function assertWorkflowCatalogRows

serv/metadata_test.go:452–475  ·  view source on GitHub ↗
(t *testing.T, s *graphjinService, name, summary string, want int)

Source from the content-addressed store, hash-verified

450}
451
452func assertWorkflowCatalogRows(t *testing.T, s *graphjinService, name, summary string, want int) {
453 t.Helper()
454 where := `kind: { eq: "workflow" }, id: { eq: ` + strconv.Quote("workflow:"+name) + ` }`
455 if summary != "" {
456 where += `, summary: { eq: ` + strconv.Quote(summary) + ` }`
457 }
458 query := `query { gj_catalog(where: { ` + where + ` }) { id summary } }`
459 res, err := s.gj.GraphQL(sourceModeUserTestContext(), query, nil, nil)
460 if err != nil {
461 t.Fatalf("query workflow catalog row: %v", err)
462 }
463 var out struct {
464 GJCatalog []struct {
465 ID string `json:"id"`
466 Summary string `json:"summary"`
467 } `json:"gj_catalog"`
468 }
469 if err := json.Unmarshal(res.Data, &out); err != nil {
470 t.Fatalf("decode workflow catalog response: %v\n%s", err, res.Data)
471 }
472 if len(out.GJCatalog) != want {
473 t.Fatalf("workflow catalog rows = %d, want %d: %+v data=%s", len(out.GJCatalog), want, out.GJCatalog, res.Data)
474 }
475}
476
477func hasRuntimeRelationship(s *graphjinService, database, table, column, target string) bool {
478 if s.runtimeCore == nil {

Calls 3

QuoteMethod · 0.65
GraphQLMethod · 0.45

Tested by

no test coverage detected