Skip to content

Commit

Permalink
Merge pull request #20 from saidone75/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
saidone75 authored May 16, 2024
2 parents 94e8c6e + a9fc224 commit 740cea6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/weller/filters.clj
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@
(defn is-file?
"Checks if an event corresponds to a repository node of type *cm:content* or subtype (i.e. a file)."
[]
)
(partial #(get-in % [:data :resource :is-file])))

(defn is-folder?
"Checks if an event corresponds to a repository node of type *cm:folder* or subtype (i.e. a folder)."
[]
(partial #(= (get-in % [:data :resource :is-folder]) true)))
(partial #(get-in % [:data :resource :is-folder])))

(defn mime-type?
"Checks if an event represents a content node (i.e. *cm:content*) with a specific MIME type."
Expand Down
14 changes: 14 additions & 0 deletions test/weller/filters_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@
(not (nil? @result))
(component/stop handler)))

(deftest is-file-test
(let [result (promise)
handler (handler/make-handler (filters/is-file?) #(deliver result %))]
(tu/create-then-update-then-delete-node)
(is (:is-file @result))
(component/stop handler)))

(deftest is-folder-test
(let [result (promise)
handler (handler/make-handler (filters/is-folder?) #(deliver result %))]
(tu/create-then-update-then-delete-node)
(is (:is-folder @result))
(component/stop handler)))

(deftest mime-type-test
(let [result (promise)
handler (handler/make-handler (filters/mime-type? "text/plain") #(deliver result %))]
Expand Down

0 comments on commit 740cea6

Please sign in to comment.