From d60f5b716819c6462432a2bcc991a5afa36afeb5 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 5 Oct 2020 21:21:48 -0400 Subject: [PATCH] add failing ack test --- Urbit/Airlock.hs | 1 + test.hs | 48 ++++++++++++++++++++++++++++-------------------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/Urbit/Airlock.hs b/Urbit/Airlock.hs index 87fc63f..08d5631 100644 --- a/Urbit/Airlock.hs +++ b/Urbit/Airlock.hs @@ -7,6 +7,7 @@ module Urbit.Airlock Mark, connect, poke, + ack, ) where diff --git a/test.hs b/test.hs index ea43ce8..539aa09 100644 --- a/test.hs +++ b/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 =