Skip to content
Snippets Groups Projects
Commit 71cca1b3 authored by Allen Gilliland's avatar Allen Gilliland
Browse files

add a very simply unit test of our publisher/subscriber system in metabase.events

parent 75815c15
No related branches found
No related tags found
No related merge requests found
(ns metabase.events-test
(:require [clojure.core.async :as async]
[expectations :refer :all]
[metabase.events :as events]
(metabase [task :refer :all]
[test-setup :refer :all])))
(def testing-topic :event-test-topic)
(def testing-sub-channel (async/chan))
;; ## Basic Pub/Sub TESTS
(events/subscribe-to-topic testing-topic testing-sub-channel)
;; we should get back our originally posted object no matter what happens
(expect
{:some :object}
(events/publish-event testing-topic {:some :object}))
;; when we receive a message it should be wrapped with {:topic `topic` :item `message body`}
(expect
{:topic testing-topic
:item {:some :object}}
(async/<!! testing-sub-channel))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment