summaryrefslogtreecommitdiff
path: root/std/jwt/_algorithm_test.ts
diff options
context:
space:
mode:
authortimonson <54777088+timonson@users.noreply.github.com>2020-10-20 05:08:34 +0200
committerGitHub <noreply@github.com>2020-10-20 14:08:34 +1100
commit034ab48086557af00216ffe311c71ad4eb0ec4d5 (patch)
tree292abc572ed68eb52c1bc773e64f820497e065df /std/jwt/_algorithm_test.ts
parent992c2a436e5fe371807dd43bd293bb811fd529e7 (diff)
feat(std/jwt): add a JSON Web Token library (#7991)
Co-authored-by: Tim Reichen <timreichen@users.noreply.github.com>
Diffstat (limited to 'std/jwt/_algorithm_test.ts')
-rw-r--r--std/jwt/_algorithm_test.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/std/jwt/_algorithm_test.ts b/std/jwt/_algorithm_test.ts
new file mode 100644
index 000000000..99583bd79
--- /dev/null
+++ b/std/jwt/_algorithm_test.ts
@@ -0,0 +1,11 @@
+import { assertEquals } from "../testing/asserts.ts";
+
+import { verify as verifyAlgorithm } from "./_algorithm.ts";
+
+Deno.test("[jwt] verify algorithm", function () {
+ assertEquals(verifyAlgorithm("HS512", "HS512"), true);
+ assertEquals(verifyAlgorithm("HS512", "HS256"), false);
+ assertEquals(verifyAlgorithm(["HS512"], "HS512"), true);
+ assertEquals(verifyAlgorithm(["HS256", "HS512"], "HS512"), true);
+ assertEquals(verifyAlgorithm(["HS512"], "HS256"), false);
+});