MCPcopy Index your code
hub / github.com/cloudquery/cloudquery / checkCreateDocsRequest

Function checkCreateDocsRequest

cli/cmd/plugin_publish_test.go:480–516  ·  view source on GitHub ↗
(t *testing.T, r *http.Request, distDir string)

Source from the content-addressed store, hash-verified

478}
479
480func checkCreateDocsRequest(t *testing.T, r *http.Request, distDir string) {
481 t.Helper()
482
483 body, err := io.ReadAll(r.Body)
484 if err != nil {
485 t.Fatal(err)
486 }
487 got := map[string]any{}
488 err = json.Unmarshal(body, &got)
489 if err != nil {
490 t.Fatal(err)
491 }
492
493 customDocContent := readFile(distDir + "/docs/Custom-Doc.md")
494 overviewContent := readFile(distDir + "/docs/overview.md")
495 configurationContent := readFile(distDir + "/docs/configuration.md")
496
497 want := map[string]any{
498 "pages": []any{
499 map[string]any{
500 "content": customDocContent,
501 "name": "Custom-Doc",
502 },
503 map[string]any{
504 "content": configurationContent,
505 "name": "configuration",
506 },
507 map[string]any{
508 "content": overviewContent,
509 "name": "overview",
510 },
511 },
512 }
513 if diff := cmp.Diff(want, got); diff != "" {
514 t.Fatalf("mismatch (-want +got):\n%s", diff)
515 }
516}
517
518func readFile(name string) string {
519 b, err := os.ReadFile(name)

Callers 3

TestPluginPublishFunction · 0.85
TestPluginPublishWithUIFunction · 0.85

Calls 1

readFileFunction · 0.85

Tested by

no test coverage detected