fix(inspect): use in-memory FS in tests so TestAssets_FallbackToIndexHTML passes without web build

This commit is contained in:
pj committed 2026-04-23 00:47:33 +07:00
1 parent 474114976e
commit b2bff510f0
1 file changed
+9 -1
+9 -1
View File
@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"io"
"io/fs"
"net/http"
"net/http/httptest"
"net/url"
@@ -11,11 +12,18 @@ import (
"path/filepath"
"strings"
"testing"
"testing/fstest"
"time"
"github.com/priyanshujain/sanderling/internal/trace"
)
var testAssetsFS fs.FS = fstest.MapFS{
"index.html": &fstest.MapFile{
Data: []byte(`<!doctype html><html><body><div id="root"></div></body></html>`),
},
}
func newFixtureServer(t *testing.T) (*Server, string) {
t.Helper()
root := t.TempDir()
@@ -48,7 +56,7 @@ func newFixtureServer(t *testing.T) (*Server, string) {
t.Fatal(err)
}
server, err := NewServer(ServerOptions{RunsDirectory: root})
server, err := NewServer(ServerOptions{RunsDirectory: root, AssetsFS: testAssetsFS})
if err != nil {
t.Fatal(err)
}