diff options
| author | Ivar Refsdal <ivar.refsdal@nsd.no> | 2021-09-27 14:36:24 +0200 |
|---|---|---|
| committer | Ivar Refsdal <ivar.refsdal@nsd.no> | 2021-09-27 14:36:24 +0200 |
| commit | 79acba1b716685bb601e05a2e9824eefd19d1f5d (patch) | |
| tree | d014d59f94251e52689a03e4ab399aa1ea0dc374 /test/com/github/ivarref/yoltq | |
| parent | Release 0.2.37 (diff) | |
| download | fiinha-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.clj | 11 |
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 |
