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