| 1753 | } |
| 1754 | |
| 1755 | func TestEmptyActionWithView(t *testing.T) { |
| 1756 | is := is.New(t) |
| 1757 | ctx := context.Background() |
| 1758 | dir := t.TempDir() |
| 1759 | td := testdir.New(dir) |
| 1760 | td.NodeModules["svelte"] = versions.Svelte |
| 1761 | td.Files["controller/controller.go"] = ` |
| 1762 | package controller |
| 1763 | type Controller struct {} |
| 1764 | func (c *Controller) Index() {} |
| 1765 | ` |
| 1766 | td.Files["view/index.svelte"] = `<h1>hello</h1>` |
| 1767 | is.NoErr(td.Write(ctx)) |
| 1768 | cli := testcli.New(dir) |
| 1769 | app, err := cli.Start(ctx, "run") |
| 1770 | is.NoErr(err) |
| 1771 | defer app.Close() |
| 1772 | res, err := app.Get("/") |
| 1773 | is.NoErr(err) |
| 1774 | // HTML response |
| 1775 | is.NoErr(res.DiffHeaders(` |
| 1776 | HTTP/1.1 200 OK |
| 1777 | Transfer-Encoding: chunked |
| 1778 | Content-Type: text/html |
| 1779 | `)) |
| 1780 | is.In(res.Body().String(), `<h1>hello</h1>`) |
| 1781 | is.NoErr(app.Close()) |
| 1782 | } |
| 1783 | |
| 1784 | func TestCustomActions(t *testing.T) { |
| 1785 | is := is.New(t) |