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,
connect,
poke,
ack,
)
where

48
test.hs
View File

@ -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 =