Skip to content

Commit e1273eb

Browse files
committed
fix: update discord service authorization test to check for unauthorized response
1 parent ae7818d commit e1273eb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/unit/middlewares/authorizeBot.test.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,20 @@ describe("Middleware | Authorize Bot", function () {
223223

224224
it("should return unauthorized when token is valid but not for cloudflare worker", function () {
225225
const jwtToken = bot.generateToken({ name: "Invalid" });
226-
227226
const request = {
228227
headers: {
229228
authorization: `Bearer ${jwtToken}`,
230229
},
231230
};
232231

233-
authorizeBot.verifyDiscordBot(request, {}, nextSpy);
232+
const response = {
233+
boom: {
234+
unauthorized: sinon.spy(),
235+
},
236+
};
237+
authorizeBot.verifyDiscordBot(request, response, nextSpy);
234238
expect(nextSpy.calledOnce).to.be.equal(false);
239+
expect(response.boom.unauthorized.calledOnce).to.be.equal(true);
235240
});
236241
});
237242
});

0 commit comments

Comments
 (0)