File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -192,11 +192,11 @@ describe("Middleware | Authorize Bot", function () {
192
192
} ) ;
193
193
194
194
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 } ) ;
196
196
const request = {
197
197
headers : {
198
198
authorization : `Bearer ${ jwtToken } ` ,
199
- [ HEADERS . SERVICE_NAME ] : DISCORD_SERVICE ,
199
+ [ HEADERS . SERVICE_NAME ] : CLOUDFLARE_WORKER ,
200
200
} ,
201
201
} ;
202
202
@@ -215,10 +215,15 @@ describe("Middleware | Authorize Bot", function () {
215
215
} ,
216
216
} ;
217
217
218
- const response = { } ;
218
+ const response = {
219
+ boom : {
220
+ unauthorized : boomUnauthorizedSpy ,
221
+ } ,
222
+ } ;
219
223
220
224
authorizeBot . verifyDiscordBot ( request , response , nextSpy ) ;
221
225
expect ( nextSpy . calledOnce ) . to . be . equal ( false ) ;
226
+ expect ( response . boom . unauthorized . calledOnce ) . to . be . equal ( true ) ;
222
227
} ) ;
223
228
224
229
it ( "should return unauthorized when token is valid but not for cloudflare worker" , function ( ) {
You can’t perform that action at this time.
0 commit comments