|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
(ns wanijo.infra.system-test
|
|
|
|
|
(:require [clojure.test :refer :all]
|
|
|
|
|
[neo4j-clj.core :as drv]
|
|
|
|
|
[clojure.string :as string]
|
|
|
|
|
[wanijo.infra.neo4j :as neo4j]
|
|
|
|
|
[wanijo.infra.repl :as repl]
|
|
|
|
|
[wanijo.schema.routes :as schema-routes]
|
|
|
|
@ -126,4 +127,31 @@
|
|
|
|
|
|
|
|
|
|
(is (= (:uuid instance2)
|
|
|
|
|
(single-result "MATCH (i:instance)<-[:link]-(:instance)
|
|
|
|
|
RETURN i.uuid")))))
|
|
|
|
|
RETURN i.uuid"))))
|
|
|
|
|
|
|
|
|
|
(testing "show instances"
|
|
|
|
|
(let [resp (inst-routes/route-show!
|
|
|
|
|
(:uuid instance)
|
|
|
|
|
{:session {:uuid (:uuid user)}})]
|
|
|
|
|
(is (true? (string? resp)))
|
|
|
|
|
(is (true? (string/includes? resp (:name instance))))
|
|
|
|
|
(is (true? (string/includes? resp (:name schema)))))
|
|
|
|
|
(let [resp (inst-routes/route-show!
|
|
|
|
|
(:uuid instance2)
|
|
|
|
|
{:session {:uuid (:uuid user)}})]
|
|
|
|
|
(is (true? (string? resp)))
|
|
|
|
|
(is (true? (string/includes? resp (:name instance))))
|
|
|
|
|
(is (true? (string/includes? resp (:name schema))))))
|
|
|
|
|
|
|
|
|
|
(testing "delete first instance"
|
|
|
|
|
(inst-routes/route-delete! (:uuid instance))
|
|
|
|
|
(is (= 1 (single-result "MATCH (i:instance) RETURN COUNT(i)")))
|
|
|
|
|
(is (= 1 (single-result "MATCH (p:property) RETURN COUNT(p)")))
|
|
|
|
|
(is (= 1 (single-result "MATCH (s:schema) RETURN COUNT(s)")))
|
|
|
|
|
(is (= 0 (single-result "MATCH ()-[l:link]-() RETURN COUNT(l)"))))
|
|
|
|
|
|
|
|
|
|
(testing "delete second instance"
|
|
|
|
|
(inst-routes/route-delete! (:uuid instance2))
|
|
|
|
|
(is (= 0 (single-result "MATCH (i:instance) RETURN COUNT(i)")))
|
|
|
|
|
(is (= 0 (single-result "MATCH (p:property) RETURN COUNT(p)")))
|
|
|
|
|
(is (= 1 (single-result "MATCH (s:schema) RETURN COUNT(s)")))))
|
|
|
|
|