File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 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 () {
227227 const secret = "shhh" ;
228228 const token = jwt . sign ( { foo : 'bar' , iss : 'http://www' } , secret ) ;
229229 // 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, '' ) ;
231234 const splitetToken = token . split ( "." ) ;
232235 splitetToken [ 1 ] = newContent ;
233236 const newToken = splitetToken . join ( "." ) ;
@@ -238,7 +241,7 @@ describe('failure tests', function () {
238241 expressjwt ( { secret : secret , algorithms : [ 'HS256' ] } ) ( req , res , function ( err ) {
239242 assert . ok ( err ) ;
240243 assert . equal ( err . code , 'invalid_token' ) ;
241- assert . equal ( err . message , 'invalid token ' ) ;
244+ assert . equal ( err . message , 'invalid signature ' ) ;
242245 done ( ) ;
243246 } ) ;
244247 } ) ;
You can’t perform that action at this time.
0 commit comments