~singpolyma/cheogram-smtp

ref: 80203ece1cdf324feb2e66c766b2f4ca3256d464 cheogram-smtp/test/IQManagerTest.hs -rw-r--r-- 689 bytes
80203eceStephen Paul Weber Baseline bidirectional working for text bodies 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module IQManagerTest where

import Prelude ()
import BasicPrelude
import Control.Concurrent.STM (atomically)
import Test.Tasty.HUnit
import Test.QuickCheck.Instances ()
import qualified Network.Protocol.XMPP as XMPP
import qualified Network.Protocol.XMPP.Internal as XMPP

import Util
import IQManager

unit_iqManager :: IO ()
unit_iqManager = do
	(sendIQ, iqReceived) <- iqManager'
	stm <- sendIQ iqToSend
	iqReceived iqResult
	result <- atomically stm
	fmap XMPP.stanzaToElement result @?=
		(Just $ XMPP.stanzaToElement iqResult)
	where
	iqToSend = (XMPP.emptyIQ XMPP.IQSet) {
		XMPP.iqID = Just (s"theID")
	}
	iqResult = (XMPP.emptyIQ XMPP.IQResult) {
		XMPP.iqID = Just (s"theID")
	}