File tree 2 files changed +20
-4
lines changed
2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,8 @@ function check(username, token) {
28
28
if ( typeof token !== 'string' ) {
29
29
errorExit ( `token must be a string, received ${ typeof token } ` ) ;
30
30
}
31
- if ( ! / ^ [ 0 - 9 a - f ] + $ / . test ( token ) ) {
32
- errorExit ( `token must be lowercase hexadecimal, received ${ token } ` ) ;
31
+ if ( ! / ^ [ A - Z a - z 0 - 9 _ ] + $ / . test ( token ) ) {
32
+ errorExit ( `token is misformatted: ${ token } ` ) ;
33
33
}
34
34
}
35
35
Original file line number Diff line number Diff line change @@ -102,9 +102,25 @@ describe('auth', async function() {
102
102
it ( 'does not accept an invalid token format' , async function ( ) {
103
103
this . timeout ( 2000 ) ;
104
104
await runAuthScript (
105
- { HOME : { username : 'nyancat' , token : '0123456789ABCDEF ' } } ,
105
+ { HOME : { username : 'nyancat' , token : '@fhqwhgads ' } } ,
106
106
[ ] ,
107
- 'token must be lowercase hexadecimal, received 0123456789ABCDEF\n'
107
+ 'token is misformatted: @fhqwhgads\n'
108
+ ) ;
109
+ } ) ;
110
+
111
+ it ( 'permits capital letters in token format' , async function ( ) {
112
+ this . timeout ( 2000 ) ;
113
+ await runAuthScript (
114
+ { HOME : { username : 'nyancat' , token : '0123456789ABCDEF' } } ,
115
+ [ '{"github":"bnlhbmNhdDowMTIzNDU2Nzg5QUJDREVG"}' ]
116
+ ) ;
117
+ } ) ;
118
+
119
+ it ( 'permits underscores in token format' , async function ( ) {
120
+ this . timeout ( 2000 ) ;
121
+ await runAuthScript (
122
+ { HOME : { username : 'nyancat' , token : 'ghp_0123456789ABCDEF' } } ,
123
+ [ '{"github":"bnlhbmNhdDpnaHBfMDEyMzQ1Njc4OUFCQ0RFRg=="}' ]
108
124
) ;
109
125
} ) ;
110
126
} ) ;
You can’t perform that action at this time.
0 commit comments