Skip to content

Commit

Permalink
node-type-test
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Marini committed May 16, 2024
1 parent e3d890c commit 88ae5e8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 2 additions & 3 deletions src/weller/filters.clj
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,9 @@
(not (= type type-before))))))

(defn node-type?
;; TODO
"Checks if an event represents a node with a specific type."
[]
)
[type]
(partial #(= (get-in % [:data :resource :node-type]) (name type))))

(defn property-added?
;; TODO
Expand Down
11 changes: 9 additions & 2 deletions test/weller/filters_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@
(deftest node-type-changed-test
(let [result (promise)
handler (handler/make-handler (filters/node-type-changed?) #(deliver result %))]
(tu/change-type)
(println @result)
(tu/change-type cm/type-savedquery)
(is (= (:node-type @result) (name cm/type-savedquery)))
(component/stop handler)))

(deftest node-type-test
(let [result (promise)
handler (handler/make-handler (filters/node-type? cm/type-savedquery) #(deliver result %))]
(tu/change-type cm/type-savedquery)
(is (= (:node-type @result) (name cm/type-savedquery)))
(component/stop handler)))
4 changes: 2 additions & 2 deletions test/weller/test_utils.clj
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@
(delete-node folder-id)))

(defn change-type
[]
[type]
(let [created-node-id (create-node)]
(->> (model/map->UpdateNodeBody {:node-type cm/type-savedquery})
(->> (model/map->UpdateNodeBody {:node-type type})
(nodes/update-node (:ticket @c/config) created-node-id))
(delete-node created-node-id)))

Expand Down

0 comments on commit 88ae5e8

Please sign in to comment.