use temp dir for the $filesystem.local test
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
|||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -1008,8 +1009,15 @@ func TestFilesystemBinds(t *testing.T) {
|
|||||||
}))
|
}))
|
||||||
defer srv.Close()
|
defer srv.Close()
|
||||||
|
|
||||||
|
tmpDir, err := os.MkdirTemp("", "jsvm")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
vm := goja.New()
|
vm := goja.New()
|
||||||
vm.Set("mh", &multipart.FileHeader{Filename: "test"})
|
vm.Set("mh", &multipart.FileHeader{Filename: "test"})
|
||||||
|
vm.Set("tmpDir", tmpDir)
|
||||||
vm.Set("testFile", filepath.Join(app.DataDir(), "data.db"))
|
vm.Set("testFile", filepath.Join(app.DataDir(), "data.db"))
|
||||||
vm.Set("baseURL", srv.URL)
|
vm.Set("baseURL", srv.URL)
|
||||||
baseBinds(vm)
|
baseBinds(vm)
|
||||||
@@ -1032,7 +1040,7 @@ func TestFilesystemBinds(t *testing.T) {
|
|||||||
|
|
||||||
// local
|
// local
|
||||||
{
|
{
|
||||||
v, err := vm.RunString(`$filesystem.local("test")`)
|
v, err := vm.RunString(`$filesystem.local(tmpDir)`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user