summaryrefslogtreecommitdiff
path: root/Biz/Devalloc.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2021-02-22 20:31:16 -0500
committerBen Sima <ben@bsima.me>2021-02-22 20:31:16 -0500
commit86d0526cca812d88e01fdef361c3578961d9bdba (patch)
tree70b8696f286c905688678c094259f91960e0ae8e /Biz/Devalloc.hs
parent87eb5ab7628ddc524d1f48cd61faccd17ed2353e (diff)
Test for empty GitHub user email
Diffstat (limited to 'Biz/Devalloc.hs')
-rw-r--r--Biz/Devalloc.hs22
1 files 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