From 86d0526cca812d88e01fdef361c3578961d9bdba Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 22 Feb 2021 20:31:16 -0500 Subject: Test for empty GitHub user email --- Biz/Devalloc.hs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Biz/Devalloc.hs b/Biz/Devalloc.hs index f0d8883..2333cac 100644 --- a/Biz/Devalloc.hs +++ b/Biz/Devalloc.hs @@ -389,7 +389,11 @@ test_upsertGitHubUser load = [ Test.unit "userId is not mempty" <| do (_, _, k) <- load Right User {..} <- upsertGitHubUser k "token" ghUser - userId @?!= mempty + userId @?!= mempty, + Test.unit "creates user when email is empty" <| do + (_, _, k) <- load + Right User {..} <- upsertGitHubUser k "token" ghUser {GitHub.userEmail = Nothing} + userEmail @?!= UserEmail Nothing ] where ghUser = @@ -440,7 +444,11 @@ Usage: |] move :: Cli.Arguments -> IO () -move _ = Exception.bracket startup shutdown run +move args = + Exception.bracket + (startup <| args `Cli.has` Cli.longOption "quiet") + shutdown + run startup :: IO (Config, Application, Acid.AcidState Keep) startup = do @@ -490,8 +498,14 @@ test = Test.group "Biz.Devalloc" [ test_calculateScore, - Test.with startup (\t@(c, _, _) -> shutdown t >> tidy c) test_upsertGitHubUser, - Test.with startup (\t@(c, _, _) -> shutdown t >> tidy c) test_analyzeGitHub + Test.with + (startup True) + (\t@(c, _, _) -> shutdown t >> tidy c) + test_upsertGitHubUser, + Test.with + (startup True) + (\t@(c, _, _) -> shutdown t >> tidy c) + test_analyzeGitHub ] -- * app configurations -- cgit v1.2.3