mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
import { describe, expect, it } from "bun:test";
|
|
import jwt from "jsonwebtoken";
|
|
|
|
describe("issue 304 - verifying values other than strings", function () {
|
|
it("should fail with numbers", function (done) {
|
|
jwt.verify(123, "foo", function (err) {
|
|
expect(err.name).toEqual("JsonWebTokenError");
|
|
done();
|
|
});
|
|
});
|
|
|
|
it("should fail with objects", function (done) {
|
|
jwt.verify({ foo: "bar" }, "biz", function (err) {
|
|
expect(err.name).toEqual("JsonWebTokenError");
|
|
done();
|
|
});
|
|
});
|
|
|
|
it("should fail with arrays", function (done) {
|
|
jwt.verify(["foo"], "bar", function (err) {
|
|
expect(err.name).toEqual("JsonWebTokenError");
|
|
done();
|
|
});
|
|
});
|
|
|
|
it("should fail with functions", function (done) {
|
|
jwt.verify(
|
|
function () {},
|
|
"foo",
|
|
function (err) {
|
|
expect(err.name).toEqual("JsonWebTokenError");
|
|
done();
|
|
},
|
|
);
|
|
});
|
|
|
|
it("should fail with booleans", function (done) {
|
|
jwt.verify(true, "foo", function (err) {
|
|
expect(err.name).toEqual("JsonWebTokenError");
|
|
done();
|
|
});
|
|
});
|
|
});
|