You've already forked pocketbase
mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-11-25 15:42:01 +02:00
added Context JSVM bind
This commit is contained in:
@@ -43,7 +43,7 @@ func TestBaseBindsCount(t *testing.T) {
|
||||
vm := goja.New()
|
||||
baseBinds(vm)
|
||||
|
||||
testBindsCount(vm, "this", 34, t)
|
||||
testBindsCount(vm, "this", 35, t)
|
||||
}
|
||||
|
||||
func TestBaseBindsSleep(t *testing.T) {
|
||||
@@ -138,6 +138,30 @@ func TestBaseBindsUnmarshal(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBaseBindsContext(t *testing.T) {
|
||||
vm := goja.New()
|
||||
baseBinds(vm)
|
||||
|
||||
_, err := vm.RunString(`
|
||||
const base = new Context(null, "a", 123);
|
||||
const sub = new Context(base, "b", 456);
|
||||
|
||||
const scenarios = [
|
||||
{key: "a", expected: 123},
|
||||
{key: "b", expected: 456},
|
||||
];
|
||||
|
||||
for (let s of scenarios) {
|
||||
if (sub.value(s.key) != s.expected) {
|
||||
throw new("Expected " +s.key + " value " + s.expected + ", got " + sub.value(s.key));
|
||||
}
|
||||
}
|
||||
`)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBaseBindsCookie(t *testing.T) {
|
||||
vm := goja.New()
|
||||
baseBinds(vm)
|
||||
|
||||
Reference in New Issue
Block a user