aboutsummaryrefslogtreecommitdiff
path: root/test/js/third_party/jsonwebtoken/undefined_secretOrPublickey.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/js/third_party/jsonwebtoken/undefined_secretOrPublickey.test.js')
-rw-r--r--test/js/third_party/jsonwebtoken/undefined_secretOrPublickey.test.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/js/third_party/jsonwebtoken/undefined_secretOrPublickey.test.js b/test/js/third_party/jsonwebtoken/undefined_secretOrPublickey.test.js
new file mode 100644
index 000000000..fb3f3b8d3
--- /dev/null
+++ b/test/js/third_party/jsonwebtoken/undefined_secretOrPublickey.test.js
@@ -0,0 +1,18 @@
+import jwt from "jsonwebtoken";
+import { expect, describe, it } from "bun:test";
+
+var TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.t-IDcSemACt8x4iTMCda8Yhe3iZaWbvV5XKSTbuAn0M";
+
+describe("verifying without specified secret or public key", function () {
+ it("should not verify null", function () {
+ expect(function () {
+ jwt.verify(TOKEN, null);
+ }).toThrow(/secret or public key must be provided/);
+ });
+
+ it("should not verify undefined", function () {
+ expect(function () {
+ jwt.verify(TOKEN);
+ }).toThrow(/secret or public key must be provided/);
+ });
+});