jsmod/jsmod_test.go

25 lines
399 B
Go

package jsmod_test
import (
"testing"
"apigo.cc/go/jsmod"
)
func TestRegister(t *testing.T) {
jsmod.Register("test", map[string]any{"foo": "bar"}, "foo")
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")
}
}