Add persistent render graph loadouts, grouped node authoring, code-appending apply behavior, explicit playground lighting, and resilient worker startup. Amp-Thread-ID: https://ampcode.com/threads/T-01a033d4-0e44-708e-af0e-6166283416ff Co-authored-by: Heaust Azure <heaust.azure@gmail.com>
41 lines
869 B
Go
41 lines
869 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestLoadPackages(t *testing.T) {
|
|
directory := t.TempDir()
|
|
for _, name := range []string{
|
|
"core.js",
|
|
"handles.js",
|
|
"fxnode-rg.js",
|
|
"fxnode-worker.js",
|
|
"worker.js",
|
|
"importer-worker.js",
|
|
"bvh-worker.js",
|
|
filepath.Join("pkg", "yawn_core_bg.wasm"),
|
|
} {
|
|
path := filepath.Join(directory, name)
|
|
if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := os.WriteFile(path, []byte(name), 0o644); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
packages, err := loadPackages(directory)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(packages) != 8 {
|
|
t.Fatalf("package count = %d", len(packages))
|
|
}
|
|
if content := string(packages["pkg/yawn_core_bg.wasm"].content); content != filepath.Join("pkg", "yawn_core_bg.wasm") {
|
|
t.Fatalf("WASM content = %q", content)
|
|
}
|
|
}
|