@@ -117,8 +117,8 @@ describe("Middleware | Authorize Bot", function () {
117
117
} ) ;
118
118
} ) ;
119
119
120
- describe ( "Check authorization of bot for discord service" , function ( done ) {
121
- it ( "return false when token is expired or malformed for discord service" , function ( ) {
120
+ describe ( "Check authorization of bot for discord service" , function ( ) {
121
+ it ( "should return unauthorized when token is expired or malformed for discord service" , function ( ) {
122
122
const jwtStub = sinon . stub ( jwt , "verify" ) . throws ( new Error ( "invalid token" ) ) ;
123
123
124
124
const request = {
@@ -144,7 +144,7 @@ describe("Middleware | Authorize Bot", function () {
144
144
jwtStub . restore ( ) ;
145
145
} ) ;
146
146
147
- it ( "return false when token is invalid from discord service" , function ( ) {
147
+ it ( "should return bad request when token is invalid for discord service" , function ( ) {
148
148
const request = {
149
149
headers : {
150
150
authorization : `Bearer BAD_TOKEN` ,
@@ -164,7 +164,7 @@ describe("Middleware | Authorize Bot", function () {
164
164
expect ( response . boom . badRequest . calledOnce ) . to . be . equal ( true ) ;
165
165
} ) ;
166
166
167
- it ( "return true when token is valid for discord service" , function ( ) {
167
+ it ( "should allow request propagation when token is valid for discord service" , function ( ) {
168
168
const jwtToken = bot . generateDiscordServiceToken ( { name : DISCORD_SERVICE } ) ;
169
169
const request = {
170
170
headers : {
@@ -180,7 +180,7 @@ describe("Middleware | Authorize Bot", function () {
180
180
expect ( nextSpy . calledOnce ) . to . be . equal ( true ) ;
181
181
} ) ;
182
182
183
- it ( "return true when token is valid for cloudflare worker where service name is not DISCORD_SERVICE" , function ( ) {
183
+ it ( "should allow request propagation when token is valid for cloudflare worker and service name is not DISCORD_SERVICE" , function ( ) {
184
184
const jwtToken = bot . generateDiscordServiceToken ( { name : DISCORD_SERVICE } ) ;
185
185
const request = {
186
186
headers : {
@@ -196,7 +196,7 @@ describe("Middleware | Authorize Bot", function () {
196
196
expect ( nextSpy . calledOnce ) . to . be . equal ( true ) ;
197
197
} ) ;
198
198
199
- it ( "return false when token is valid but not for discord service" , function ( ) {
199
+ it ( "should return unauthorized when token is valid but not for discord service" , function ( ) {
200
200
const jwtToken = bot . generateDiscordServiceToken ( { name : "Invalid" } ) ;
201
201
const request = {
202
202
headers : {
@@ -212,7 +212,7 @@ describe("Middleware | Authorize Bot", function () {
212
212
expect ( nextSpy . calledOnce ) . to . be . equal ( false ) ;
213
213
} ) ;
214
214
215
- it ( "return false when token is valid but not for cloudflare worker" , function ( ) {
215
+ it ( "should return unauthorized when token is valid but not for cloudflare worker" , function ( ) {
216
216
const jwtToken = bot . generateToken ( { name : "Invalid" } ) ;
217
217
218
218
const request = {
0 commit comments