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/list-entries-for-dir
(sut/create-resource "dummy" (sut/path-if-exists fs-root "dummy") :filesytem))))))) (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 (deftest test-get-resources
; TODO: base path should not be empty ; TODO: base path should not be empty
(is (is
(= [{:virtual-path "dummy" :source-type :filesystem :resource-type :dir} (= ["dummy" "dummy/dummy2" "dummy/dummy2/dummy2_from_fs"
{:virtual-path "dummy/dummy2" :source-type :filesystem :resource-type :dir} "dummy/dummy2/dummy_common" "dummy/dummy_from_fs"]
{:virtual-path "dummy/dummy2/dummy2_from_fs" :source-type :filesystem :resource-type :file} (sort (map ftt/filter-path
{:virtual-path "dummy/dummy2/dummy_common" :source-type :filesystem :resource-type :file} (sut/get-resources fs-root "" ["dummy"])))))
{:virtual-path "dummy/dummy_from_fs" :source-type :filesystem :resource-type :file}]
(map ftt/filter-object
(sut/get-resources fs-root "" ["dummy"]))))
(is (is
(= [{:virtual-path "dummy_from_fs" :source-type :filesystem :resource-type :file}] (= [{:virtual-path "dummy_from_fs" :source-type :filesystem :resource-type :file}]
(map ftt/filter-object (map ftt/filter-object

View file

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

View file

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