fix tests

This commit is contained in:
Jan Krebs 2020-01-28 01:09:41 +01:00
parent f9ec3e294f
commit d6604e9616
3 changed files with 13 additions and 16 deletions

View file

@ -38,17 +38,13 @@
(sut/list-entries-for-dir
(sut/create-resource "dummy" (sut/path-if-exists fs-root "dummy") :filesytem)))))))
; TODO: sort output to get consistent tests on all systems. Yet, order of output maps can be different on different systems
(deftest test-get-resources
; TODO: base path should not be empty
(is
(= [{:virtual-path "dummy" :source-type :filesystem :resource-type :dir}
{:virtual-path "dummy/dummy2" :source-type :filesystem :resource-type :dir}
{:virtual-path "dummy/dummy2/dummy2_from_fs" :source-type :filesystem :resource-type :file}
{:virtual-path "dummy/dummy2/dummy_common" :source-type :filesystem :resource-type :file}
{:virtual-path "dummy/dummy_from_fs" :source-type :filesystem :resource-type :file}]
(map ftt/filter-object
(sut/get-resources fs-root "" ["dummy"]))))
(= ["dummy" "dummy/dummy2" "dummy/dummy2/dummy2_from_fs"
"dummy/dummy2/dummy_common" "dummy/dummy_from_fs"]
(sort (map ftt/filter-path
(sut/get-resources fs-root "" ["dummy"])))))
(is
(= [{:virtual-path "dummy_from_fs" :source-type :filesystem :resource-type :file}]
(map ftt/filter-object

View file

@ -28,14 +28,11 @@
(map ftt/filter-object
(sut/get-resources-recursive "not-existing" "dummy" ["dummy_from_jar"]))))
(is (=
[{:virtual-path "dummy2/dummy2_from_jar", :source-type :java-classpath-jar, :resource-type :file}
{:virtual-path "dummy2/dummy_common", :source-type :filesystem, :resource-type :file}
{:virtual-path "dummy2", :source-type :filesystem, :resource-type :dir}
{:virtual-path "dummy_from_jar", :source-type :java-classpath-jar, :resource-type :file}
{:virtual-path "dummy_from_fs", :source-type :filesystem, :resource-type :file}
{:virtual-path "dummy2/dummy2_from_fs", :source-type :filesystem, :resource-type :file}]
(map ftt/filter-object
(sut/get-resources-recursive "fs_root" "dummy" ["dummy_from_jar" "dummy_from_fs" "dummy2"]))))
(sort ["dummy2/dummy2_from_jar" "dummy2/dummy_common" "dummy2" "dummy_from_jar" "dummy_from_fs"
"dummy2/dummy2_from_fs"])
(sort (map ftt/filter-path
(sut/get-resources-recursive "fs_root" "dummy"
["dummy_from_jar" "dummy_from_fs" "dummy2"])))))
(is (=
[{:virtual-path "js/dummy.js"
:source-type :java-classpath-filesystem

View file

@ -28,3 +28,7 @@
{:virtual-path (:virtual-path e)
:source-type (:source-type e)
:resource-type (:resource-type e)})
(defn filter-path
[e]
(:virtual-path e))