aboutsummaryrefslogtreecommitdiff
path: root/test/com/github/ivarref/yoltq
diff options
context:
space:
mode:
authorIvar Refsdal <ivar.refsdal@nsd.no>2021-09-27 14:36:24 +0200
committerIvar Refsdal <ivar.refsdal@nsd.no>2021-09-27 14:36:24 +0200
commit79acba1b716685bb601e05a2e9824eefd19d1f5d (patch)
treed014d59f94251e52689a03e4ab399aa1ea0dc374 /test/com/github/ivarref/yoltq
parentRelease 0.2.37 (diff)
downloadfiinha-79acba1b716685bb601e05a2e9824eefd19d1f5d.tar.gz
fiinha-79acba1b716685bb601e05a2e9824eefd19d1f5d.tar.xz
Add :valid-payload? function
Diffstat (limited to 'test/com/github/ivarref/yoltq')
-rw-r--r--test/com/github/ivarref/yoltq/virtual_test.clj11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/com/github/ivarref/yoltq/virtual_test.clj b/test/com/github/ivarref/yoltq/virtual_test.clj
index 8f7b454..acd3eb7 100644
--- a/test/com/github/ivarref/yoltq/virtual_test.clj
+++ b/test/com/github/ivarref/yoltq/virtual_test.clj
@@ -331,3 +331,14 @@
(yq/add-consumer! :a identity)
(timbre/with-level :fatal
(is (thrown? Exception @(d/transact conn [(yq/put :a {:broken #'=})]))))))
+
+
+(deftest payload-verifier
+ (let [conn (u/empty-conn)]
+ (yq/init! {:conn conn})
+ (yq/add-consumer! :q identity
+ {:valid-payload? (fn [{:keys [id]}]
+ (some? id))})
+ @(d/transact conn [(yq/put :q {:id "a"})])
+ (timbre/with-level :fatal
+ (is (thrown? Exception @(d/transact conn [(yq/put :q {})])))))) \ No newline at end of file