Skip to content

Commit

Permalink
Add a test for with-all
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Hanlon committed Sep 27, 2020
1 parent 06e9ea4 commit bbd0c7b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/leiningen/monolith.clj
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@
[monolith subprojects] (u/load-monolith! project)
targets (target/select monolith subprojects opts)
profile (plugin/merged-profile monolith (select-keys subprojects targets))
project (reduce (fn remove-replace [m k] (update m k vary-meta assoc :replace false)) project (keys profile))]
project (reduce (fn remove-replace
[m k]
(update m k vary-meta assoc :replace false))
project (keys profile))]
(lein/apply-task
task
(plugin/add-active-profile project :monolith/all profile)
Expand Down
26 changes: 26 additions & 0 deletions test/leiningen/monolith_test.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
(ns leiningen.monolith-test
(:require
[clojure.java.io :as io]
[clojure.test :refer [deftest is]]
[leiningen.core.project :as project]
[leiningen.monolith :as sut]))


(defn absolute-path
[path]
(.. (io/file path) toPath toAbsolutePath))


(deftest with-all-test
(let [project (project/read "example/project.clj")
output (with-out-str (sut/with-all project ["pprint" ":test-paths"]))
path (absolute-path "example")]
(is (= ["test/unit"
"test/integration"
"apps/app-a/test/unit"
"apps/app-a/test/integration"
"libs/lib-b/test"
"libs/lib-a/test/unit"
"libs/lib-a/test/integration"]
(mapv #(str (.relativize path (absolute-path %)))
(read-string output))))))

0 comments on commit bbd0c7b

Please sign in to comment.