Skip to content

Commit 4706642

Browse files
committed
fix: update service name in authorization test for cloudflare worker
1 parent 296c744 commit 4706642

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/unit/middlewares/authorizeBot.test.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,11 @@ describe("Middleware | Authorize Bot", function () {
192192
});
193193

194194
it("should allow request propagation when token is valid for cloudflare worker and service name is not DISCORD_SERVICE", function () {
195-
const jwtToken = bot.generateDiscordServiceToken({ name: DISCORD_SERVICE });
195+
const jwtToken = bot.generateDiscordServiceToken({ name: CLOUDFLARE_WORKER });
196196
const request = {
197197
headers: {
198198
authorization: `Bearer ${jwtToken}`,
199-
[HEADERS.SERVICE_NAME]: DISCORD_SERVICE,
199+
[HEADERS.SERVICE_NAME]: CLOUDFLARE_WORKER,
200200
},
201201
};
202202

@@ -215,10 +215,15 @@ describe("Middleware | Authorize Bot", function () {
215215
},
216216
};
217217

218-
const response = {};
218+
const response = {
219+
boom: {
220+
unauthorized: boomUnauthorizedSpy,
221+
},
222+
};
219223

220224
authorizeBot.verifyDiscordBot(request, response, nextSpy);
221225
expect(nextSpy.calledOnce).to.be.equal(false);
226+
expect(response.boom.unauthorized.calledOnce).to.be.equal(true);
222227
});
223228

224229
it("should return unauthorized when token is valid but not for cloudflare worker", function () {

0 commit comments

Comments
 (0)