jsmod/jsmod_test.go

25 lines
399 B
Go
Raw Permalink Normal View History

2026-05-30 14:11:56 +08:00
package jsmod_test
import (
"testing"
"apigo.cc/go/jsmod"
2026-05-30 14:11:56 +08:00
)
func TestRegister(t *testing.T) {
jsmod.Register("test", map[string]any{"foo": "bar"}, "foo")
2026-05-30 14:11:56 +08:00
mods := jsmod.GetModules()
mod, ok := mods["test"]
if !ok {
t.Fatal("Module not found")
}
if mod.Exports["foo"] != "bar" {
t.Error("Export failed")
}
if !mod.UnsafeList["foo"] {
t.Error("UnsafeList tracking failed")
2026-05-30 14:11:56 +08:00
}
}