Skip to content

Commit

Permalink
Process all examples as tests, print paths, check non-blank (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsteeg committed Sep 13, 2023
1 parent 94b8f2d commit 6b96c01
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/clj/metafacture_playground/process_test.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns metafacture-playground.process-test
(:require [clojure.test :refer [deftest testing is]]
[clojure.string :refer [blank?]]
[metafacture-playground.process :refer [process]]
[clojure.java.io :as io]
[lambdaisland.uri :refer [uri query-string->map]]))
Expand Down Expand Up @@ -47,12 +48,13 @@
(is (= result (:result test-data)))))))

(deftest process-examples-test
(testing "Process all examples in resources/examples without exceptions."
(testing "Process all examples in resources/examples and assert that the result is not blank (nil, empty, or contains only whitespace)."
(let [examples (->> (io/resource "examples")
io/file
.listFiles
file-seq
(keep #(when (.isFile %)
(println "Testing example:" (.getPath %))
(slurp %)))
(map #(-> % uri :query query-string->map)))]
(doseq [example examples]
(is (process (:flux example) (:data example) (:transformation example)))))))
(is (not (blank? (process (:flux example) (:data example) (:transformation example)))))))))

0 comments on commit 6b96c01

Please sign in to comment.