MCPcopy
hub / github.com/livebud/bud / TestCreateSeesWelcome

Function TestCreateSeesWelcome

internal/cli/create_test.go:73–104  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

71}
72
73func TestCreateSeesWelcome(t *testing.T) {
74 is := is.New(t)
75 ctx := context.Background()
76 dir := t.TempDir()
77 td := testdir.New(dir)
78 err := td.Write(ctx)
79 is.NoErr(err)
80 cli := testcli.New(dir)
81 is.NoErr(td.NotExists(".gitignore"))
82 result, err := cli.Run(ctx, "create", dir)
83 is.NoErr(err)
84 is.Equal(result.Stdout(), "")
85 is.In(result.Stderr(), "Ready")
86
87 // Start the app
88 app, err := cli.Start(ctx, "run")
89 is.NoErr(err)
90 // Test the index page
91 res, err := app.Get("/")
92 is.NoErr(err)
93 is.Equal(res.Status(), 200)
94 is.In(res.Body().String(), "Hey Bud")
95 is.In(res.Body().String(), "Hey Bud") // should work multiple times
96 // Test the client-side JS
97 res, err = app.Get("/bud/view/_index.svelte.js")
98 is.NoErr(err)
99 is.Equal(res.Status(), 200)
100 is.In(res.Body().String(), "Hey Bud")
101 is.Equal(app.Stdout(), "")
102 is.NoErr(td.Exists("bud/app"))
103 is.NoErr(app.Close())
104}
105
106func TestCreateRemoveBudGraceful(t *testing.T) {
107 is := is.New(t)

Callers

nothing calls this directly

Calls 15

NewFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92
NoErrMethod · 0.80
NotExistsMethod · 0.80
EqualMethod · 0.80
InMethod · 0.80
StatusMethod · 0.80
BodyMethod · 0.80
ExistsMethod · 0.80
RunMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected