~singpolyma/cheogram-smtp

ref: 91b56cb3edd7d5ebcbb0c11c5deca40deb4bd87d cheogram-smtp/test/IQManagerTest.hs -rw-r--r-- 689 bytes
91b56cb3Stephen Paul Weber vcard-temp for the gateway 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")
	}