File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -227,7 +227,10 @@ describe('failure tests', function () {
227
227
const secret = "shhh" ;
228
228
const token = jwt . sign ( { foo : 'bar' , iss : 'http://www' } , secret ) ;
229
229
// manipulate the token
230
- const newContent = Buffer . from ( "{foo: 'bar', edg: 'ar'}" ) . toString ( 'base64' ) ;
230
+ const newContent = Buffer
231
+ . from ( '{"foo": "bar", "edg": "ar"}' )
232
+ . toString ( 'base64' )
233
+ . replace ( / = / g, '' ) ;
231
234
const splitetToken = token . split ( "." ) ;
232
235
splitetToken [ 1 ] = newContent ;
233
236
const newToken = splitetToken . join ( "." ) ;
@@ -238,7 +241,7 @@ describe('failure tests', function () {
238
241
expressjwt ( { secret : secret , algorithms : [ 'HS256' ] } ) ( req , res , function ( err ) {
239
242
assert . ok ( err ) ;
240
243
assert . equal ( err . code , 'invalid_token' ) ;
241
- assert . equal ( err . message , 'invalid token ' ) ;
244
+ assert . equal ( err . message , 'invalid signature ' ) ;
242
245
done ( ) ;
243
246
} ) ;
244
247
} ) ;
You can’t perform that action at this time.
0 commit comments