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) } } }