Add concurrency caps, the two-pane web UI, AGENTS.md, and plan status
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
|
||||
"g.fc.run/misc/byre/internal/api"
|
||||
"g.fc.run/misc/byre/internal/server"
|
||||
"g.fc.run/misc/byre/web"
|
||||
)
|
||||
|
||||
const login = "alice@example.com"
|
||||
@@ -105,6 +106,47 @@ func TestIdentityRequired(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestServesEmbeddedSPA(t *testing.T) {
|
||||
srv, err := server.New(t.TempDir(), web.FS)
|
||||
if err != nil {
|
||||
t.Fatalf("new server: %v", err)
|
||||
}
|
||||
t.Cleanup(func() { srv.Close() })
|
||||
hs := httptest.NewServer(srv.Handler())
|
||||
t.Cleanup(hs.Close)
|
||||
|
||||
for path, contentType := range map[string]string{
|
||||
"/": "text/html",
|
||||
"/style.css": "text/css",
|
||||
"/dist/app.js": "text/javascript",
|
||||
"/dist/app.js.map": "",
|
||||
"/src/app.ts": "",
|
||||
"/dist/inbox.js": "text/javascript",
|
||||
"/dist/api.gen.js": "text/javascript",
|
||||
"/dist/tasks.js": "text/javascript",
|
||||
"/dist/navbar.js": "text/javascript",
|
||||
"/dist/panes.js": "text/javascript",
|
||||
"/dist/task.js": "text/javascript",
|
||||
"/dist/state.js": "text/javascript",
|
||||
"/dist/dom.js": "text/javascript",
|
||||
"/dist/api.js": "text/javascript",
|
||||
"/fonts/atkinson-hyperlegible-mono-latin-wght-normal.woff2": "font/woff2",
|
||||
"/fonts/LICENSE": "",
|
||||
} {
|
||||
resp, err := http.Get(hs.URL + path)
|
||||
if err != nil {
|
||||
t.Fatalf("get %s: %v", path, err)
|
||||
}
|
||||
resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
t.Fatalf("get %s: %d", path, resp.StatusCode)
|
||||
}
|
||||
if contentType != "" && !strings.HasPrefix(resp.Header.Get("Content-Type"), contentType) {
|
||||
t.Fatalf("get %s: content type %q, want %s", path, resp.Header.Get("Content-Type"), contentType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMe(t *testing.T) {
|
||||
h := newHarness(t)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user