fix(fs): mock dir handling, fix e2e tests

This commit is contained in:
Andelf
2023-03-17 10:43:42 +08:00
parent 9637c464eb
commit fdeb0775f0
4 changed files with 11 additions and 8 deletions

View File

@@ -211,7 +211,9 @@
(defmethod handle :getFiles [_window [_ path]]
(logger/debug ::get-files {:path path})
(get-files path))
(p/let [files (get-files path)]
(bean/->js {:path path
:files files})))
(defn- sanitize-graph-name
[graph-name]

View File

@@ -168,7 +168,7 @@
files (mapv (fn [entry]
(assoc entry :path (path/relative-path dir (:path entry))))
files)]
{:path dir :files files})))))
{:path path :files files})))))
(defn get-files
"List all files in the directory, recursively.

View File

@@ -71,9 +71,11 @@
[dir]
(p/let [dir-path (or dir (util/mocked-open-dir-path))
result (if dir-path
(ipc/ipc "getFiles" dir-path)
(ipc/ipc "openDir" {}))]
(prn ::open-dir result)
(do
(println "NOTE: Using mocked dir" dir-path)
(ipc/ipc "getFiles" dir-path))
(ipc/ipc "openDir" {}))
result (bean/->clj result)]
result))
(defrecord Node []
@@ -111,8 +113,7 @@
(-> (ipc/ipc "stat" fpath)
(p/then bean/->clj)))
(open-dir [_this dir]
(p/then (open-dir dir)
bean/->clj))
(open-dir dir))
(get-files [_this dir]
(-> (ipc/ipc "getFiles" dir)
(p/then bean/->clj)))

View File

@@ -263,7 +263,7 @@
[repo-url {:keys [file-objs new-graph? empty-graph?]}]
(spec/validate :repos/url repo-url)
(route-handler/redirect-to-home!)
(prn ::load---new-file-objs repo-url)
(prn ::load-new-repo repo-url :empty-graph? empty-graph? :new-graph? new-graph?)
(state/set-parsing-state! {:graph-loading? true})
(let [repo-dir (config/get-local-dir repo-url)
_ (prn ::repo-dir repo-dir)