feat: update embed.go to embed all assets and add tests for SPA asset inclusion
This commit is contained in:
+1
-1
@@ -4,5 +4,5 @@ package webspa
|
|||||||
|
|
||||||
import "embed"
|
import "embed"
|
||||||
|
|
||||||
//go:embed out
|
//go:embed all:out
|
||||||
var SPA embed.FS
|
var SPA embed.FS
|
||||||
|
|||||||
@@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user