Initial Commit
This commit is contained in:
25
src/cljs/emptyhead/test/idea/property.cljs
Normal file
25
src/cljs/emptyhead/test/idea/property.cljs
Normal file
@@ -0,0 +1,25 @@
|
||||
(ns emptyhead.test.idea.property
|
||||
(:require [cljs.test :as t :include-macros true]
|
||||
[emptyhead.idea.crud :as crud]
|
||||
[emptyhead.idea.property :as prop]
|
||||
[emptyhead.test.fixtures :as fx]))
|
||||
|
||||
(t/use-fixtures :once fx/temporary-state)
|
||||
(t/use-fixtures :each fx/pre-reset)
|
||||
|
||||
(t/deftest properties
|
||||
(t/testing "Property addition and removal"
|
||||
(let [idea (crud/have-idea!)]
|
||||
(prop/register-property! idea [:a :b :c] [:a :d :e])
|
||||
|
||||
(t/is (= #{[:a :b :c] [:a :d :e] [:a] [:a :b] [:a :d]}
|
||||
(prop/properties idea)))
|
||||
|
||||
(t/is (prop/has-property? idea [:a :b]))
|
||||
(t/is (not (prop/has-property? idea [:invalid])))
|
||||
|
||||
(t/is (contains? (prop/with-property [:a :d]) idea))
|
||||
(t/is (not (contains? (prop/with-property [:invalid]) idea)))
|
||||
|
||||
(prop/remove-property! idea [:a :b])
|
||||
(t/is (not (prop/has-property? idea [:a :b :c]))))))
|
Reference in New Issue
Block a user