Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mime-type-test #19

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)))