[#3273] added readerToString() JSVM helper

This commit is contained in:
Gani Georgiev
2023-09-10 10:46:19 +03:00
parent b2c8f394af
commit 0ca86a0c87
38 changed files with 3956 additions and 3877 deletions
+21 -1
View File
@@ -46,7 +46,27 @@ func TestBaseBindsCount(t *testing.T) {
vm := goja.New()
baseBinds(vm)
testBindsCount(vm, "this", 13, t)
testBindsCount(vm, "this", 14, t)
}
func TestBaseBindsReaderToString(t *testing.T) {
app, _ := tests.NewTestApp()
defer app.Cleanup()
vm := goja.New()
baseBinds(vm)
vm.Set("reader", strings.NewReader("test"))
_, err := vm.RunString(`
let result = readerToString(reader)
if (result != "test") {
throw new Error('Expected "test", got ' + result);
}
`)
if err != nil {
t.Fatal(err)
}
}
func TestBaseBindsRecord(t *testing.T) {