Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vruttant1403 committed Apr 3, 2024
1 parent 4c30d91 commit c7ce1dd
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions test/ziggurat/mapper_test.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(ns ziggurat.mapper-test
(:require [clojure.test :refer :all]
[schema.core :as s]
[ziggurat.config :refer [ziggurat-config get-configured-retry-count]]
[ziggurat.config :refer [ziggurat-config get-configured-retry-count get-channel-retry-count]]
[ziggurat.fixtures :as fix]
[ziggurat.mapper :refer :all]
[ziggurat.messaging.producer-connection :refer [producer-connection]]
Expand Down Expand Up @@ -320,5 +320,18 @@
(is (nil? (:topic-entity user-msg-payload))))]
(with-redefs [metrics/increment-count (constantly nil)
metrics/report-histogram (constantly nil)]
((channel-mapper-func user-handler-fn channel) message-payload)
(is @user-handler-called))))))
((channel-mapper-func user-handler-fn channel) message-payload)
(is @user-handler-called))))
(testing "retry-count set to nil returns rabbitmq-retry-count 0"
(let [user-handler-called (atom false)
message-payload {:retry-count 0
:topic-entity topic
:metadata metadata}
user-handler-fn (fn [user-msg-payload]
(reset! user-handler-called true)
(is (= ((get user-msg-payload :metadata) :rabbitmq-retry-count ) 0)))]
(with-redefs [metrics/increment-count (constantly nil)
get-channel-retry-count (constantly nil) ]
((channel-mapper-func user-handler-fn channel) message-payload)
(is @user-handler-called))))))

0 comments on commit c7ce1dd

Please sign in to comment.