Просмотр исходного кода

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

Andelf 2 лет назад
Родитель
Сommit
fdeb0775f0

+ 3 - 1
src/electron/electron/handler.cljs

@@ -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]

+ 1 - 1
src/main/frontend/fs.cljs

@@ -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.

+ 6 - 5
src/main/frontend/fs/node.cljs

@@ -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)))

+ 1 - 1
src/main/frontend/handler/repo.cljs

@@ -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)