fix test by providing a MockService
This commit is contained in:
parent
89706f688a
commit
8faa9dc016
|
@ -1,3 +1,5 @@
|
||||||
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
module FediChordSpec where
|
module FediChordSpec where
|
||||||
|
|
||||||
|
@ -292,12 +294,15 @@ exampleNodeState = RemoteNodeState {
|
||||||
, vServerID = 0
|
, vServerID = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
exampleLocalNode :: IO (LocalNodeState s)
|
exampleLocalNode :: IO (LocalNodeState MockService)
|
||||||
exampleLocalNode = nodeStateInit =<< (newTVarIO $ RealNode {
|
exampleLocalNode = do
|
||||||
|
realNode <- newTVarIO $ RealNode {
|
||||||
vservers = []
|
vservers = []
|
||||||
, nodeConfig = exampleFediConf
|
, nodeConfig = exampleFediConf
|
||||||
, bootstrapNodes = confBootstrapNodes exampleFediConf
|
, bootstrapNodes = confBootstrapNodes exampleFediConf
|
||||||
})
|
, nodeService = MockService
|
||||||
|
}
|
||||||
|
nodeStateInit realNode
|
||||||
|
|
||||||
|
|
||||||
exampleFediConf :: FediChordConf
|
exampleFediConf :: FediChordConf
|
||||||
|
@ -313,3 +318,9 @@ exampleVs :: (Integral i) => i
|
||||||
exampleVs = 4
|
exampleVs = 4
|
||||||
exampleIp :: HostAddress6
|
exampleIp :: HostAddress6
|
||||||
exampleIp = tupleToHostAddress6 (0x2001, 0x16b8, 0x755a, 0xb110, 0x7d6a, 0x12ab, 0xf0c5, 0x386e)
|
exampleIp = tupleToHostAddress6 (0x2001, 0x16b8, 0x755a, 0xb110, 0x7d6a, 0x12ab, 0xf0c5, 0x386e)
|
||||||
|
|
||||||
|
data MockService d = MockService
|
||||||
|
|
||||||
|
instance DHT d => Service MockService d where
|
||||||
|
runService _ _ = pure MockService
|
||||||
|
getListeningPortFromService = const 1337
|
||||||
|
|
Loading…
Reference in a new issue