From d6604e9616893a98f8500432ce0487ea236b2873 Mon Sep 17 00:00:00 2001 From: Jan Krebs Date: Tue, 28 Jan 2020 01:09:41 +0100 Subject: [PATCH] fix tests --- test/cryogen_core/classpath_able_io/fs_test.clj | 12 ++++-------- test/cryogen_core/classpath_able_io_test.clj | 13 +++++-------- test/cryogen_core/file_test_tools.clj | 4 ++++ 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/test/cryogen_core/classpath_able_io/fs_test.clj b/test/cryogen_core/classpath_able_io/fs_test.clj index 2606c19..5b89366 100644 --- a/test/cryogen_core/classpath_able_io/fs_test.clj +++ b/test/cryogen_core/classpath_able_io/fs_test.clj @@ -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 diff --git a/test/cryogen_core/classpath_able_io_test.clj b/test/cryogen_core/classpath_able_io_test.clj index 295b0b2..f3e4b19 100644 --- a/test/cryogen_core/classpath_able_io_test.clj +++ b/test/cryogen_core/classpath_able_io_test.clj @@ -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 diff --git a/test/cryogen_core/file_test_tools.clj b/test/cryogen_core/file_test_tools.clj index ea99ce3..c709816 100644 --- a/test/cryogen_core/file_test_tools.clj +++ b/test/cryogen_core/file_test_tools.clj @@ -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))