Back
RefSet (clj)
(source)record
Examples
duct-framework/core
(ns duct.core-test
(:require [clojure.java.io :as io]
[clojure.test :refer :all]
[duct.core :as core]
[duct.core.merge :as merge]
[integrant.core :as ig]))
(deftest test-profile-keyword
(core/load-hierarchy)
(let [m {:duct.profile/base {::a 1, ::b (ig/ref ::a)}
[:duct/profile ::x] {::a 2, ::c (ig/refset ::b)}}
p (ig/prep m)]
(is (= p
{:duct.profile/base {::a 1, ::b (core/->InertRef ::a)}
[:duct/profile ::x] {::a 2, ::c (core/->InertRefSet ::b)
::core/requires (ig/refset :duct.profile/base)}}))
(is (= (core/fold-modules (ig/init p))
{::a 2, ::b (ig/ref ::a), ::c (ig/refset ::b)}))))
(deftest test-profile-dev-keyword
(core/load-hierarchy)
(let [m {:duct.profile/base {::a 1, ::b (ig/ref ::a)}
:duct.profile/dev {::a 2, ::c (ig/refset ::b)}}
p (ig/prep m)]
(is (= p
{:duct.profile/base {::a 1, ::b (core/->InertRef ::a)}
:duct.profile/dev {::a 2, ::c (core/->InertRefSet ::b)
::core/requires (ig/refset :duct.profile/base)
::core/environment :development}}))
(is (= (core/fold-modules (ig/init p))
{::a 2, ::b (ig/ref ::a), ::c (ig/refset ::b)
::core/environment :development}))))
(deftest test-profile-test-keyword
(core/load-hierarchy)
(let [m {:duct.profile/base {::a 1, ::b (ig/ref ::a)}
:duct.profile/test {::a 2, ::c (ig/refset ::b)}}
p (ig/prep m)]
(is (= p
{:duct.profile/base {::a 1, ::b (core/->InertRef ::a)}
:duct.profile/test {::a 2, ::c (core/->InertRefSet ::b)
::core/requires (ig/refset :duct.profile/base)
::core/environment :test}}))
(is (= (core/fold-modules (ig/init p))
{::a 2, ::b (ig/ref ::a), ::c (ig/refset ::b)
::core/environment :test}))))
(deftest test-profile-prod-keyword
(core/load-hierarchy)
(let [m {:duct.profile/base {::a 1, ::b (ig/ref ::a)}
:duct.profile/prod {::a 2, ::c (ig/refset ::b)}}
p (ig/prep m)]
(is (= p
{:duct.profile/base {::a 1, ::b (core/->InertRef ::a)}
:duct.profile/prod {::a 2, ::c (core/->InertRefSet ::b)
::core/requires (ig/refset :duct.profile/base)
::core/environment :production}}))
(is (= (core/fold-modules (ig/init p))
{::a 2, ::b (ig/ref ::a), ::c (ig/refset ::b)
::core/environment :production}))))