add option to load more than one test-spec
This commit is contained in:
parent
d4a5690a88
commit
9503aeddaf
2 changed files with 20 additions and 5 deletions
|
@ -36,9 +36,12 @@
|
||||||
#"-" "_")
|
#"-" "_")
|
||||||
#"\." "/"))
|
#"\." "/"))
|
||||||
|
|
||||||
(s/defn find-data-spec-files :- [s/Any]
|
(s/defn data-test-spec-file-names :- [s/Str]
|
||||||
[data-test-spec-file-prefix :- s/Str]
|
[name-key :- s/Keyword]
|
||||||
(.listFiles (io/resource (str data-test-spec-file-prefix "*.edn"))))
|
(let [prefix (data-test-spec-file-prefix name-key)]
|
||||||
|
(cons (str prefix ".edn")
|
||||||
|
(map #(str prefix "." % ".edn")
|
||||||
|
(range 10)))))
|
||||||
|
|
||||||
(s/defn load-test-data
|
(s/defn load-test-data
|
||||||
[file-prefix :- s/Str]
|
[file-prefix :- s/Str]
|
||||||
|
|
|
@ -31,6 +31,20 @@
|
||||||
(is (= "data_test/file_loader_test/test_it"
|
(is (= "data_test/file_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
|
||||||
|
(is (= '("data_test/file_loader_test/test_it.edn"
|
||||||
|
"data_test/file_loader_test/test_it.0.edn"
|
||||||
|
"data_test/file_loader_test/test_it.1.edn"
|
||||||
|
"data_test/file_loader_test/test_it.2.edn"
|
||||||
|
"data_test/file_loader_test/test_it.3.edn"
|
||||||
|
"data_test/file_loader_test/test_it.4.edn"
|
||||||
|
"data_test/file_loader_test/test_it.5.edn"
|
||||||
|
"data_test/file_loader_test/test_it.6.edn"
|
||||||
|
"data_test/file_loader_test/test_it.7.edn"
|
||||||
|
"data_test/file_loader_test/test_it.8.edn"
|
||||||
|
"data_test/file_loader_test/test_it.9.edn")
|
||||||
|
(sut/data-test-spec-file-names ::test-it))))
|
||||||
|
|
||||||
(deftest should-load-data
|
(deftest should-load-data
|
||||||
(is (= {:test "data"}
|
(is (= {:test "data"}
|
||||||
(sut/load-test-data (sut/data-test-spec-file-prefix ::test-it)))))
|
(sut/load-test-data (sut/data-test-spec-file-prefix ::test-it)))))
|
||||||
|
@ -38,5 +52,3 @@
|
||||||
(deftest should-throw-exception
|
(deftest should-throw-exception
|
||||||
(is (thrown? RuntimeException
|
(is (thrown? RuntimeException
|
||||||
(sut/load-test-data (sut/data-test-spec-file-prefix ::not-existing)))))
|
(sut/load-test-data (sut/data-test-spec-file-prefix ::not-existing)))))
|
||||||
|
|
||||||
;(sut/find-data-spec-files (sut/data-test-spec-file-prefix ::test-it))
|
|
||||||
|
|
Loading…
Reference in a new issue