refactor system test to use controller functions

alfred
Josha von Gizycki 4 years ago committed by Josha von Gizycki
parent 4e3f0f86bd
commit bc0585f772

@ -36,7 +36,7 @@
:required false
:widget :checkbox
:from-req #(if (some? %) 1 0)}
:uuid {:widget :hidden}}
:uuid {:widget :hidden}}
:form-specs [::unique-attr-name-per-schema]})
(defn assign-form [users]

@ -3,14 +3,14 @@
[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
(first
(neo4j/exec-query!
(drv/create-query cypher) {}))))
(first
(neo4j/exec-query!
(drv/create-query cypher) {}))))
(deftest allround-system-test
(repl/setup-in-memory!)
@ -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"
:name "test-attr"
:required 1}
(:uuid schema)
(:uuid user))
(attr-routes/new! {:params {:schema (:uuid schema)
:name "test-attr"
: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)

Loading…
Cancel
Save