Skip to content

Commit

Permalink
Merge pull request #19 from saidone75/dev
Browse files Browse the repository at this point in the history
mime-type-test
  • Loading branch information
saidone75 authored May 16, 2024
2 parents e75a8ba + 0696fd6 commit 328edfa
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
Empty file modified alfresco.sh
100644 → 100755
Empty file.
Empty file modified cljdoc-lein-preview.sh
100644 → 100755
Empty file.
5 changes: 2 additions & 3 deletions src/weller/filters.clj
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@
(defn content-changed?
"Checks if an event represents a content update (i.e. file updated) of a *cm:content* node in the repository."
[]
(partial #(let [
content (get-in % [:data :resource :content])
(partial #(let [content (get-in % [:data :resource :content])
content-before (get-in % [:data :resource-before :content])]
(if-not (or (nil? content) (nil? content-before))
(and
Expand All @@ -114,7 +113,7 @@
[mime-type]
(partial #(let [resource (get-in % [:data :resource])]
(and
(= (:node-type resource) (name cm/type-content))
(:is-file resource)
(= (get-in resource [:content :mime-type]) mime-type)))))

(defn node-aspect?
Expand Down
7 changes: 7 additions & 0 deletions test/weller/filters_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,11 @@
handler (handler/make-handler (filters/content-changed?) #(deliver result %))]
(tu/create-then-update-then-delete-node)
(not (nil? @result))
(component/stop handler)))

(deftest mime-type-test
(let [result (promise)
handler (handler/make-handler (filters/mime-type? "text/plain") #(deliver result %))]
(tu/create-then-update-then-delete-node)
(is (= (get-in @result [:content :mime-type]) "text/plain"))
(component/stop handler)))

0 comments on commit 328edfa

Please sign in to comment.