diff options
| author | Arnaud Bailly <arnaud@pankzsoft.com> | 2025-11-05 06:28:38 +0100 |
|---|---|---|
| committer | Arnaud Bailly <arnaud@pankzsoft.com> | 2025-11-05 06:28:38 +0100 |
| commit | 3621ddbdff4d52ad58f9af57b8a47e50d42be948 (patch) | |
| tree | 56f3a0e0d2dcf293364ed0a3f5c3429a1c5139a1 /lambda-calcul/haskell/test/Minilang | |
| parent | 7fbba2eb68ec5855d7af0adcf4fe0d6948177a43 (diff) | |
| download | lambda-nantes-3621ddbdff4d52ad58f9af57b8a47e50d42be948.tar.gz | |
return correct leaderboard
Diffstat (limited to 'lambda-calcul/haskell/test/Minilang')
| -rw-r--r-- | lambda-calcul/haskell/test/Minilang/ServerSpec.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lambda-calcul/haskell/test/Minilang/ServerSpec.hs b/lambda-calcul/haskell/test/Minilang/ServerSpec.hs index 50c1590..c7c45b3 100644 --- a/lambda-calcul/haskell/test/Minilang/ServerSpec.hs +++ b/lambda-calcul/haskell/test/Minilang/ServerSpec.hs @@ -39,9 +39,9 @@ spec = with (app testSeed) $ do else Just "Expected HTML content" } - it "GET /api/leaderboard returns empty list of scores" $ do + it "GET /api/leaderboard returns empty list of scores at start" $ do get "/api/leaderboard" - `shouldRespondWith` 200 {matchBody = arrayOfLengthOf (Proxy @Score) 2} + `shouldRespondWith` 200 {matchBody = arrayOfLengthOf (Proxy @Score) 0} it "POST /api/register returns registration token given user is not registered" $ do postJSON "/api/register" alice @@ -53,6 +53,11 @@ spec = with (app testSeed) $ do else Just ("Expected token " ++ show token ++ ", but got " ++ show t) } + it "GET /api/leaderboard returns list of one element after user registers" $ do + void $ postJSON "/api/register" alice + get "/api/leaderboard" + `shouldRespondWith` 200 {matchBody = arrayOfLengthOf (Proxy @Score) 1} + it "POST /api/register returns 400 given user is already registered" $ do void $ postJSON "/api/register" alice |
