Test that an improperly encoded JWT returns a DecodeError

The subject of this commit message says it all.
This commit is contained in:
William Carroll 2020-08-08 13:46:57 +01:00
parent d34b146702
commit 526728eb89

View file

@ -16,6 +16,9 @@ main = hspec $ do
describe "GoogleSignIn" $ describe "GoogleSignIn" $
describe "jwtIsValid" $ do describe "jwtIsValid" $ do
let jwtIsValid' = GoogleSignIn.jwtIsValid True let jwtIsValid' = GoogleSignIn.jwtIsValid True
it "returns a decode error when an incorrectly encoded JWT is used" $ do
jwtIsValid' (GoogleSignIn.EncodedJWT "rubbish") `shouldReturn` DecodeError
it "returns validation error when the aud field doesn't match my client ID" $ do it "returns validation error when the aud field doesn't match my client ID" $ do
let auds = ["wrong-client-id"] let auds = ["wrong-client-id"]
|> fmap TestUtils.unsafeStringOrURI |> fmap TestUtils.unsafeStringOrURI