add failing ack test

This commit is contained in:
Ben Sima 2020-10-05 21:21:48 -04:00
parent 153ba3bf2b
commit d60f5b7168
2 changed files with 29 additions and 20 deletions

View File

@ -7,6 +7,7 @@ module Urbit.Airlock
Mark, Mark,
connect, connect,
poke, poke,
ack,
) )
where where

48
test.hs
View File

@ -19,27 +19,35 @@ main :: IO ()
main = do main = do
let ship = fakezod let ship = fakezod
testing "ship connection" $ isJust <$> do testing "ship connection" $
r <- connect ship isJust <$> do
return $ r ^? Wreq.responseBody r <- connect ship
return $ r ^? Wreq.responseBody
testing "poke ship" $ isJust <$> do testing "poke ship" $
r <- (poke ship "zod" "chat-hook" "json" $ isJust <$> do
Aeson.object r <-
[ "message" poke ship "zod" "chat-hook" "json" $
.= Aeson.object Aeson.object
[ "path" .= Text.pack "/~/~zod/mc", [ "message"
"envelope" .= Aeson.object
.= Aeson.object [ "path" .= Text.pack "/~/~zod/mc",
[ "uid" .= Text.pack "FIXME", "envelope"
"number" .= lastEventId ship, .= Aeson.object
"author" .= Text.pack "~zod", [ "uid" .= Text.pack "FIXME",
"when" .= Text.pack "FIXME", -- int(time.time() * 1000) "number" .= lastEventId ship,
"letter" .= Aeson.object ["text" .= Text.pack "hello world!"] "author" .= Text.pack "~zod",
] "when" .= Text.pack "FIXME", -- int(time.time() * 1000)
] "letter" .= Aeson.object ["text" .= Text.pack "hello world!"]
]) ]
return $ r ^? Wreq.responseBody ]
]
return $ r ^? Wreq.responseBody
testing "ack" $
isJust <$> do
r <- ack ship 1
return $ r ^? Wreq.responseBody
fakezod :: Ship fakezod :: Ship
fakezod = fakezod =