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

Function TestNewControllerNoActions

internal/cli/new_controller_test.go:19–45  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17)
18
19func TestNewControllerNoActions(t *testing.T) {
20 is := is.New(t)
21 ctx := context.Background()
22 dir := t.TempDir()
23 td := testdir.New(dir)
24 err := td.Write(ctx)
25 is.NoErr(err)
26 cli := testcli.New(dir)
27 result, err := cli.Run(ctx, "new", "controller", "hello")
28 is.NoErr(err)
29 is.Equal(result.Stdout(), "")
30 is.Equal(result.Stderr(), "")
31 is.NoErr(td.Exists("controller/hello/controller.go"))
32 app, err := cli.Start(ctx, "run")
33 is.NoErr(err)
34 defer app.Close()
35 res, err := app.GetJSON("/")
36 is.NoErr(err)
37 is.NoErr(res.Diff(`
38 HTTP/1.1 404 Not Found
39 Content-Type: text/plain; charset=utf-8
40 X-Content-Type-Options: nosniff
41
42 404 page not found
43 `))
44 is.NoErr(app.Close())
45}
46
47func TestNewControllerNoActionsRoute(t *testing.T) {
48 is := is.New(t)

Callers

nothing calls this directly

Calls 14

NewFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92
NoErrMethod · 0.80
EqualMethod · 0.80
ExistsMethod · 0.80
GetJSONMethod · 0.80
DiffMethod · 0.80
RunMethod · 0.65
CloseMethod · 0.65
WriteMethod · 0.45
StdoutMethod · 0.45

Tested by

no test coverage detected