Skip to content

Commit

Permalink
create test for virify_jwt/2 #9
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Apr 24, 2020
1 parent e197283 commit b57d545
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/token_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,14 @@ defmodule AuthPlugTokenTest do
decoded = verify_jwt!(jwt, secret)
assert data.email == Map.get(decoded, "email")
end


test "verify_jwt/2 verifies a JWT with the given secret" do
secret = "secretcanbeanystringyouwant"
data = %{email: "[email protected]", name: "Alex"}
jwt = generate_jwt!(data, secret)

{:ok, decoded} = verify_jwt(jwt, secret)
assert data.email == Map.get(decoded, "email")
end
end

0 comments on commit b57d545

Please sign in to comment.