diff --git a/src/weller/filters.clj b/src/weller/filters.clj index 90a2f76..8f63e3a 100644 --- a/src/weller/filters.clj +++ b/src/weller/filters.clj @@ -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." diff --git a/test/weller/filters_test.clj b/test/weller/filters_test.clj index 0ebf887..61b6196 100644 --- a/test/weller/filters_test.clj +++ b/test/weller/filters_test.clj @@ -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 %))]