feat: workspace helpers - quoting paths, what a dropped file does, with node tests

This commit is contained in:
redtea committed 2026-10-15 20:00:26 +03:00
1 parent 0ada0899cf
commit 7b9daa524e
4 files changed
+90

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
package server
import (
"net/http"
"net/http/httptest"
"testing"
"testing/fstest"
)
func TestStaticHidesTests(t *testing.T) {
fsys := fstest.MapFS{
"wsutil.js": {Data: []byte("x")},
"wsutil.test.js": {Data: []byte("y")},
}
h := staticHandler(fsys, map[string]string{})
for path, want := range map[string]int{"/wsutil.js": 200, "/wsutil.test.js": 404} {
w := httptest.NewRecorder()
h.ServeHTTP(w, httptest.NewRequest(http.MethodGet, path, nil))
if w.Code != want {
t.Errorf("%s: got %d, want %d", path, w.Code, want)
}
}
}