mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
fix(inspect): use in-memory FS in tests so TestAssets_FallbackToIndexHTML passes without web build
This commit is contained in:
1 parent
474114976e
commit
b2bff510f0
1 file changed
+9
-1
@@ -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)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user