|
|
|
@ -3,8 +3,8 @@
|
|
|
|
|
[neo4j-clj.core :as drv]
|
|
|
|
|
[wanijo.infra.neo4j :as neo4j]
|
|
|
|
|
[wanijo.infra.repl :as repl]
|
|
|
|
|
[wanijo.schema.db :as db-schema]
|
|
|
|
|
[wanijo.attribute.db :as db-attr]))
|
|
|
|
|
[wanijo.schema.routes :as schema-routes]
|
|
|
|
|
[wanijo.attribute.routes :as attr-routes]))
|
|
|
|
|
|
|
|
|
|
(defn single-result [cypher extractor]
|
|
|
|
|
(extractor
|
|
|
|
@ -19,7 +19,8 @@
|
|
|
|
|
:u))
|
|
|
|
|
|
|
|
|
|
(testing "create schema"
|
|
|
|
|
(db-schema/create-new! "test-schema" (:uuid user))
|
|
|
|
|
(schema-routes/new! {:params {:name "test-schema"}
|
|
|
|
|
:session {:uuid (:uuid user)}})
|
|
|
|
|
(def schema
|
|
|
|
|
(single-result "MATCH (s:schema) RETURN s LIMIT 1" :s))
|
|
|
|
|
(is (= "test-schema" (:name schema)))
|
|
|
|
@ -29,15 +30,15 @@
|
|
|
|
|
(is (not= nil (:created_at schema))))
|
|
|
|
|
|
|
|
|
|
(testing "create attribute"
|
|
|
|
|
(db-attr/create-new! {:type "text"
|
|
|
|
|
(attr-routes/new! {:params {:schema (:uuid schema)
|
|
|
|
|
:name "test-attr"
|
|
|
|
|
:required 1}
|
|
|
|
|
(:uuid schema)
|
|
|
|
|
(:uuid user))
|
|
|
|
|
:type "string"
|
|
|
|
|
:required "1"}
|
|
|
|
|
:session {:uuid (:uuid user)}})
|
|
|
|
|
(def attr
|
|
|
|
|
(single-result "MATCH (a:attribute) RETURN a" :a))
|
|
|
|
|
(is (= "text") (:type attr))
|
|
|
|
|
(is (= "test-attr") (:name attr))
|
|
|
|
|
(is (= "string" (:type attr)))
|
|
|
|
|
(is (= "test-attr" (:name attr)))
|
|
|
|
|
(is (= 1 (:required attr)))
|
|
|
|
|
(is (= (:uuid user)
|
|
|
|
|
(single-result "MATCH (a:attribute)-[:created_by]->(u:user)
|
|
|
|
|