mirror of
https://github.com/bsima/haskell-urbit-api.git
synced 2024-08-17 14:00:31 +03:00
add failing ack test
This commit is contained in:
parent
153ba3bf2b
commit
d60f5b7168
@ -7,6 +7,7 @@ module Urbit.Airlock
|
||||
Mark,
|
||||
connect,
|
||||
poke,
|
||||
ack,
|
||||
)
|
||||
where
|
||||
|
||||
|
48
test.hs
48
test.hs
@ -19,27 +19,35 @@ main :: IO ()
|
||||
main = do
|
||||
let ship = fakezod
|
||||
|
||||
testing "ship connection" $ isJust <$> do
|
||||
r <- connect ship
|
||||
return $ r ^? Wreq.responseBody
|
||||
testing "ship connection" $
|
||||
isJust <$> do
|
||||
r <- connect ship
|
||||
return $ r ^? Wreq.responseBody
|
||||
|
||||
testing "poke ship" $ isJust <$> do
|
||||
r <- (poke ship "zod" "chat-hook" "json" $
|
||||
Aeson.object
|
||||
[ "message"
|
||||
.= Aeson.object
|
||||
[ "path" .= Text.pack "/~/~zod/mc",
|
||||
"envelope"
|
||||
.= Aeson.object
|
||||
[ "uid" .= Text.pack "FIXME",
|
||||
"number" .= lastEventId ship,
|
||||
"author" .= Text.pack "~zod",
|
||||
"when" .= Text.pack "FIXME", -- int(time.time() * 1000)
|
||||
"letter" .= Aeson.object ["text" .= Text.pack "hello world!"]
|
||||
]
|
||||
]
|
||||
])
|
||||
return $ r ^? Wreq.responseBody
|
||||
testing "poke ship" $
|
||||
isJust <$> do
|
||||
r <-
|
||||
poke ship "zod" "chat-hook" "json" $
|
||||
Aeson.object
|
||||
[ "message"
|
||||
.= Aeson.object
|
||||
[ "path" .= Text.pack "/~/~zod/mc",
|
||||
"envelope"
|
||||
.= Aeson.object
|
||||
[ "uid" .= Text.pack "FIXME",
|
||||
"number" .= lastEventId ship,
|
||||
"author" .= Text.pack "~zod",
|
||||
"when" .= Text.pack "FIXME", -- int(time.time() * 1000)
|
||||
"letter" .= Aeson.object ["text" .= Text.pack "hello world!"]
|
||||
]
|
||||
]
|
||||
]
|
||||
return $ r ^? Wreq.responseBody
|
||||
|
||||
testing "ack" $
|
||||
isJust <$> do
|
||||
r <- ack ship 1
|
||||
return $ r ^? Wreq.responseBody
|
||||
|
||||
fakezod :: Ship
|
||||
fakezod =
|
||||
|
Loading…
Reference in New Issue
Block a user