refactor file-loader -> loader

This commit is contained in:
jem 2019-05-29 19:00:43 +02:00
parent 868a53b077
commit 267723fc83
8 changed files with 21 additions and 22 deletions

View file

@ -18,7 +18,7 @@
[clojure.test :as t] [clojure.test :as t]
[schema.core :as s] [schema.core :as s]
[data-test.reporter :as reporter] [data-test.reporter :as reporter]
[data-test.file-loader :as loader])) [data-test.loader :as loader]))
(def TestDataSpec loader/TestDataSpec) (def TestDataSpec loader/TestDataSpec)

View file

@ -13,7 +13,7 @@
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and ; See the License for the specific language governing permissions and
; limitations under the License. ; limitations under the License.
(ns data-test.file-loader (ns data-test.loader
(:require (:require
[clojure.java.io :as io] [clojure.java.io :as io]
[clojure.string :as str] [clojure.string :as str]

View file

@ -1 +0,0 @@
{:test "data"}

View file

@ -13,12 +13,12 @@
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and ; See the License for the specific language governing permissions and
; limitations under the License. ; limitations under the License.
(ns data-test.file-loader-test (ns data-test.loader-test
(:require (:require
[clojure.test :refer :all] [clojure.test :refer :all]
[clojure.java.io :as io] [clojure.java.io :as io]
[schema.core :as s] [schema.core :as s]
[data-test.file-loader :as sut])) [data-test.loader :as sut]))
(deftest should-read-test-data-spec (deftest should-read-test-data-spec
(is (= {:simple "test"} (is (= {:simple "test"}
@ -28,26 +28,26 @@
) )
(deftest should-calculate-data-test-spec-file-prefix (deftest should-calculate-data-test-spec-file-prefix
(is (= "data_test/file_loader_test/test_it" (is (= "data_test/loader_test/test_it"
(sut/data-test-spec-file-prefix ::test-it)))) (sut/data-test-spec-file-prefix ::test-it))))
(deftest should-list-all-posible-resources (deftest should-list-all-posible-resources
(is (= '("data_test/file_loader_test/test_it.edn" (is (= '("data_test/loader_test/test_it.edn"
"data_test/file_loader_test/test_it.0.edn" "data_test/loader_test/test_it.0.edn"
"data_test/file_loader_test/test_it.1.edn" "data_test/loader_test/test_it.1.edn"
"data_test/file_loader_test/test_it.2.edn" "data_test/loader_test/test_it.2.edn"
"data_test/file_loader_test/test_it.3.edn" "data_test/loader_test/test_it.3.edn"
"data_test/file_loader_test/test_it.4.edn" "data_test/loader_test/test_it.4.edn"
"data_test/file_loader_test/test_it.5.edn" "data_test/loader_test/test_it.5.edn"
"data_test/file_loader_test/test_it.6.edn" "data_test/loader_test/test_it.6.edn"
"data_test/file_loader_test/test_it.7.edn" "data_test/loader_test/test_it.7.edn"
"data_test/file_loader_test/test_it.8.edn" "data_test/loader_test/test_it.8.edn"
"data_test/file_loader_test/test_it.9.edn") "data_test/loader_test/test_it.9.edn")
(sut/data-test-spec-file-names ::test-it)))) (sut/data-test-spec-file-names ::test-it))))
(deftest should-load-data (deftest should-load-data
(is (= {:test "data" (is (= {:test "data"
:data-spec-file "data_test/file_loader_test/test_it.edn"} :data-spec-file "data_test/loader_test/test_it.edn"}
(sut/load-data-test-spec (str (sut/data-test-spec-file-prefix ::test-it) ".edn"))))) (sut/load-data-test-spec (str (sut/data-test-spec-file-prefix ::test-it) ".edn")))))
(deftest should-not-load-non-existing-data (deftest should-not-load-non-existing-data
@ -56,11 +56,11 @@
(deftest should-load-data-test-specs (deftest should-load-data-test-specs
(is (= [{:test "data" (is (= [{:test "data"
:data-spec-file "data_test/file_loader_test/test_it.edn"} :data-spec-file "data_test/loader_test/test_it.edn"}
{:test "data1" {:test "data1"
:data-spec-file "data_test/file_loader_test/test_it.1.edn"} :data-spec-file "data_test/loader_test/test_it.1.edn"}
{:test "data9" {:test "data9"
:data-spec-file "data_test/file_loader_test/test_it.9.edn"}] :data-spec-file "data_test/loader_test/test_it.9.edn"}]
(sut/load-data-test-specs ::test-it)))) (sut/load-data-test-specs ::test-it))))
(deftest should-throw-exception (deftest should-throw-exception

View file

@ -18,7 +18,7 @@
[clojure.test :refer :all] [clojure.test :refer :all]
[clojure.java.io :as io] [clojure.java.io :as io]
[schema.core :as s] [schema.core :as s]
[data-test.file-loader :as fl] [data-test.loader :as fl]
[data-test :as sut])) [data-test :as sut]))
; -------------------- explicit version ------------------ ; -------------------- explicit version ------------------