diff options
| author | Arnaud Bailly <arnaud@pankzsoft.com> | 2025-11-05 08:24:05 +0100 |
|---|---|---|
| committer | Arnaud Bailly <arnaud@pankzsoft.com> | 2025-11-05 08:24:05 +0100 |
| commit | 246d370bd903edeb5570b6f016556528b8ca57fc (patch) | |
| tree | 0ce7b42c2644d1ea65b3284533666606ccc6fa61 /lambda-calcul/haskell/test/Minilang | |
| parent | abd07940e50d4b86024410971fc2c4dff058fd48 (diff) | |
| download | lambda-nantes-246d370bd903edeb5570b6f016556528b8ca57fc.tar.gz | |
can cleanup registered users
Diffstat (limited to 'lambda-calcul/haskell/test/Minilang')
| -rw-r--r-- | lambda-calcul/haskell/test/Minilang/ServerSpec.hs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lambda-calcul/haskell/test/Minilang/ServerSpec.hs b/lambda-calcul/haskell/test/Minilang/ServerSpec.hs index e109977..a60c232 100644 --- a/lambda-calcul/haskell/test/Minilang/ServerSpec.hs +++ b/lambda-calcul/haskell/test/Minilang/ServerSpec.hs @@ -64,6 +64,15 @@ spec = with (app testSeed) $ do postJSON "/api/register" alice `shouldRespondWith` 400 + it "DELETE /api/register returns 200 and deletes user score given user is registered" $ do + void $ postJSON "/api/register" alice + + request "DELETE" ("/api/register?token=" <> LBS.toStrict token) [] "" + `shouldRespondWith` 200 + + get ("/api/score?token=" <> LBS.toStrict token) + `shouldRespondWith` 404 + it "GET /api/challenge returns next challenge given user is registered" $ do let expected = LT.unpack $ decodeUtf8 $ encode $ Challenge {level = 0, expr = "x"} postJSON "/api/register" alice @@ -134,9 +143,9 @@ spec = with (app testSeed) $ do Left err -> Just $ "Failed to decode JSON: " ++ err } - it "GET /api/score returns 400 given token is not registered" $ do + it "GET /api/score returns 404 given token is not registered" $ do get ("/api/score?token=" <> LBS.toStrict token) - `shouldRespondWith` 400 + `shouldRespondWith` 404 it "GET /api/score returns score with success given last challenge succeeded" $ do void $ postJSON "/api/register" alice |
