diff options
Diffstat (limited to 'Biz/Devalloc.hs')
-rw-r--r-- | Biz/Devalloc.hs | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/Biz/Devalloc.hs b/Biz/Devalloc.hs index 1134098..59e2240 100644 --- a/Biz/Devalloc.hs +++ b/Biz/Devalloc.hs @@ -32,6 +32,8 @@ -- : dep servant-auth-server -- : dep servant-lucid -- : dep servant-server +-- : dep tasty +-- : dep tasty-hunit -- : dep uuid -- : dep vector -- : dep warp @@ -45,6 +47,8 @@ import Alpha hiding ((<.>)) import Biz.App (CSS (..), HtmlApp (..)) import qualified Biz.Cli as Cli import qualified Biz.Look +import Biz.Test ((@=?)) +import qualified Biz.Test as Test import qualified Clay import qualified Control.Exception as Exception import Crypto.JOSE.JWK (JWK) @@ -203,10 +207,8 @@ help = devalloc Usage: - devalloc [--test] - -Options: - --test Run the tests + devalloc + devalloc test |] move :: Cli.Arguments -> IO () @@ -250,8 +252,13 @@ testCookieSettings = Auth.cookieXsrfSetting = Nothing } -test :: Cli.Arguments -> IO () -test _ = test_analyzeGitHub >> pure test_calculateScore >> pure () +test :: Test.Tree +test = + Test.group + "Biz.Devalloc" + [ -- test_analyzeGitHub, + test_calculateScore + ] -- * app configurations @@ -760,15 +767,14 @@ calculateScore numTotal numBlackholes numLiabilities = numGood = numTotal - numBlackholes - numLiabilities maxScore = 100.0 -test_calculateScore :: [Bool] +test_calculateScore :: Test.Tree test_calculateScore = - [ -- perfect - 100 == calculateScore 100 0 0, - -- all blackholes - 50 == calculateScore 100 100 0, - -- all liabilities - 70 == calculateScore 100 0 100 - ] + Test.group + "calculateScore" + [ Test.unit "perfect score" <| 100 @=? calculateScore 100 0 0, + Test.unit "all blackholes" <| 50 @=? calculateScore 100 100 0, + Test.unit "all liabilities" <| 70 @=? calculateScore 100 0 100 + ] lastTouched :: FilePath -> FilePath -> IO (FilePath, Int) lastTouched bareRepo path = do @@ -869,8 +875,9 @@ analyzeGitHub githubAuth cfg o r = do ghOwner = GitHub.mkName (Proxy :: Proxy GitHub.Owner) o ghRepo = GitHub.mkName (Proxy :: Proxy GitHub.Repo) r -test_analyzeGitHub :: IO Analysis -test_analyzeGitHub = analyzeGitHub () Envy.defConfig "bsima" "bin" +-- TODO: write this test +-- test_analyzeGitHub :: IO Analysis +-- test_analyzeGitHub = analyzeGitHub () Envy.defConfig "bsima" "bin" -- | Clone the repo to @<Config.depo>/<url>@. If repo already exists, just do a -- @git fetch@. Returns the full path to the local repo. |