diff options
| author | Ivar Refsdal <ivar.refsdal@nsd.no> | 2021-09-23 11:06:33 +0200 |
|---|---|---|
| committer | Ivar Refsdal <ivar.refsdal@nsd.no> | 2021-09-23 11:06:33 +0200 |
| commit | 60f7371f4d2dd43c5b177039406eeaab00ba27cc (patch) | |
| tree | 9e34ea2576650b83e41c05f5fd3fc48c7ebf0865 /README.md | |
| parent | Add consume-twice! test function for verifying idempotence (diff) | |
| download | fiinha-60f7371f4d2dd43c5b177039406eeaab00ba27cc.tar.gz fiinha-60f7371f4d2dd43c5b177039406eeaab00ba27cc.tar.xz | |
To test-queue namespace
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -243,23 +243,23 @@ by enabling the virtual queue: ```clojure ... (:require [clojure.test :refer :all] - [com.github.ivarref.yoltq :as yq] - [com.github.ivarref.yoltq.virtual-queue :as vq]) + [com.github.ivarref.yoltq :as yq] + [com.github.ivarref.yoltq.test-queue :as tq]) ; Enables the virtual queue and disables the threadpool for each test. ; yq/start! and yq/stop! becomes a no-op. -(use-fixtures :each vq/call-with-virtual-queue!) +(use-fixtures :each tq/call-with-virtual-queue!) (deftest demo - (let [conn ...] - (dq/init! {:conn conn}) ; Setup - (dq/add-consumer! :q identity) - - @(d/transact conn [(yq/put :q {:work 123})]) ; Add work - - ; vq/consume! consumes one job and asserts that it succeeds. - ; It returns the return value of the consumer function - (is (= {:work 123} (vq/consume! :q))))) + (let [conn ...] + (yq/init! {:conn conn}) ; Setup + (yq/add-consumer! :q identity) + + @(d/transact conn [(yq/put :q {:work 123})]) ; Add work + + ; tq/consume! consumes one job and asserts that it succeeds. + ; It returns the return value of the consumer function + (is (= {:work 123} (tq/consume! :q))))) ``` |
