feat: update embed.go to embed all assets and add tests for SPA asset inclusion

This commit is contained in:
mlogclub
2026-06-07 23:11:54 +08:00
parent 1f3795465b
commit 6d1d459533
2 changed files with 21 additions and 1 deletions
+1 -1
View File
@@ -4,5 +4,5 @@ package webspa
import "embed"
//go:embed out
//go:embed all:out
var SPA embed.FS
+20
View File
@@ -0,0 +1,20 @@
package webspa
import (
"io/fs"
"testing"
)
func TestEmbeddedSPAIncludesNextExportAssets(t *testing.T) {
nextStaticInfo, err := fs.Stat(SPA, "out/_next/static")
if err != nil {
t.Fatalf("embedded SPA missing Next static assets: %v", err)
}
if !nextStaticInfo.IsDir() {
t.Fatalf("out/_next/static is not a directory")
}
if _, err := fs.Stat(SPA, "out/__next._tree.txt"); err != nil {
t.Fatalf("embedded SPA missing Next RSC export data: %v", err)
}
}