MCPcopy Index your code
hub / github.com/livebud/bud / TestJSONCreateNested

Function TestJSONCreateNested

framework/controller/controller_test.go:628–721  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

626}
627
628func TestJSONCreateNested(t *testing.T) {
629 is := is.New(t)
630 ctx := context.Background()
631 dir := t.TempDir()
632 td := testdir.New(dir)
633 td.Files["postgres/pool.go"] = `
634 package postgres
635 func New(r *http.Request) *Pool { return &Pool{r.URL.Path} }
636 type Pool struct { Path string }
637 `
638 td.Files["controller/controller.go"] = `
639 package controller
640 type Controller struct {}
641 type Post struct {
642 ID int ` + "`" + `json:"id"` + "`" + `
643 Title string ` + "`" + `json:"title"` + "`" + `
644 }
645 func (c *Controller) Create(p *Post) *Post {
646 return p
647 }
648 `
649 td.Files["controller/users/users.go"] = `
650 package users
651 type Controller struct {}
652 type Post struct {
653 ID int ` + "`" + `json:"id"` + "`" + `
654 Title string ` + "`" + `json:"title"` + "`" + `
655 }
656 func (c *Controller) Create(p *Post) *Post {
657 return p
658 }
659 `
660 td.Files["controller/users/admin/admin.go"] = `
661 package admin
662 type Controller struct {}
663 type Post struct {
664 UserID int ` + "`" + `json:"user_id"` + "`" + `
665 ID int ` + "`" + `json:"id"` + "`" + `
666 Title string ` + "`" + `json:"title"` + "`" + `
667 }
668 func (c *Controller) Create(p *Post) *Post {
669 return p
670 }
671 `
672 td.Files["controller/articles/articles.go"] = `
673 package articles
674 type Controller struct {}
675 type Post struct {
676 ID int ` + "`" + `json:"id"` + "`" + `
677 Title string ` + "`" + `json:"title"` + "`" + `
678 }
679 func (c *Controller) Create(p *Post) *Post {
680 return p
681 }
682 `
683 is.NoErr(td.Write(ctx))
684 cli := testcli.New(dir)
685 app, err := cli.Start(ctx, "run")

Callers

nothing calls this directly

Calls 9

NewFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92
NoErrMethod · 0.80
PostJSONMethod · 0.80
DiffMethod · 0.80
CloseMethod · 0.65
WriteMethod · 0.45
StartMethod · 0.45

Tested by

no test coverage detected