~singpolyma/cheogram-smtp

ref: 06e954292339d5569db11c456447e8fd72f1d6c0 cheogram-smtp/test/IQManagerTest.hs -rw-r--r-- 689 bytes
06e95429Stephen Paul Weber Add install instructions to README 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")
	}