summaryrefslogtreecommitdiff
path: root/lambda-calcul/haskell/test
diff options
context:
space:
mode:
Diffstat (limited to 'lambda-calcul/haskell/test')
-rw-r--r--lambda-calcul/haskell/test/Minilang/ServerSpec.hs9
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