1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-11-24 07:04:51 +02:00

added JSVM new Timezone binding

This commit is contained in:
Gani Georgiev
2025-01-03 17:35:49 +02:00
parent dadbca5248
commit ff3d51ce30
5 changed files with 4375 additions and 4278 deletions

View File

@@ -44,7 +44,7 @@ func TestBaseBindsCount(t *testing.T) {
vm := goja.New()
baseBinds(vm)
testBindsCount(vm, "this", 32, t)
testBindsCount(vm, "this", 33, t)
}
func TestBaseBindsSleep(t *testing.T) {
@@ -538,6 +538,31 @@ func TestBaseBindsMiddleware(t *testing.T) {
}
}
func TestBaseBindsTimezone(t *testing.T) {
vm := goja.New()
baseBinds(vm)
_, err := vm.RunString(`
const v0 = (new Timezone()).string();
if (v0 != "UTC") {
throw new Error("(v0) Expected UTC got " + v0)
}
const v1 = (new Timezone("invalid")).string();
if (v1 != "UTC") {
throw new Error("(v1) Expected UTC got " + v1)
}
const v2 = (new Timezone("EET")).string();
if (v2 != "EET") {
throw new Error("(v2) Expected EET got " + v2)
}
`)
if err != nil {
t.Fatal(err)
}
}
func TestBaseBindsDateTime(t *testing.T) {
vm := goja.New()
baseBinds(vm)