File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 6464 ((get-in f.tools.filesystem/definitions [" eca_read_file" :handler ])
6565 {" path" (h/file-path " /foo/qux" )}
6666 {:db {:workspace-folders [{:uri (h/file-uri " file:///foo/bar/baz" ) :name " foo" }]}})))))
67+ (testing " Path is a directory"
68+ (is (match?
69+ {:error true
70+ :contents [{:type :text
71+ :text (format " %s is a directory, not a file" (h/file-path " /foo/dir" ))}]}
72+ (with-redefs [fs/exists? (constantly true )
73+ fs/readable? (constantly true )
74+ fs/directory? (constantly true )
75+ f.tools.filesystem/allowed-path? (constantly true )]
76+ ((get-in f.tools.filesystem/definitions [" eca_read_file" :handler ])
77+ {" path" (h/file-path " /foo/dir" )}
78+ {:db {:workspace-folders [{:uri (h/file-uri " file:///foo/bar/baz" ) :name " foo" }]}})))))
6779 (testing " Readable path"
6880 (is (match?
6981 {:error false
7284 (with-redefs [slurp (constantly " fooo" )
7385 fs/exists? (constantly true )
7486 fs/readable? (constantly true )
87+ fs/directory? (constantly false )
7588 f.tools.filesystem/allowed-path? (constantly true )]
7689 ((get-in f.tools.filesystem/definitions [" eca_read_file" :handler ])
7790 {" path" (h/file-path " /foo/qux" )}
You can’t perform that action at this time.
0 commit comments