File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -145,9 +145,14 @@ describe('other user', () => {
145145 [ 'HEAD' , 'GET' , 'PUT' , 'DELETE' ] . forEach ( method => {
146146
147147 it ( `rejects ${ method } ` , async ( ) => {
148+ const pattern = new RegExp ( `\\/${ process . env . ACCOUNT_HANDLE } $` ) ;
149+
150+ if ( ! State . baseURL ?. match ( pattern ) )
151+ throw new Error ( 'when username is not in webfinger baseURL, set ACCOUNT_HANDLE_ALT' ) ;
152+
148153 const handle = Math . random ( ) . toString ( 36 ) . slice ( 2 ) ;
149154 const res = await util . storage ( Object . assign ( util . clone ( State ) , {
150- baseURL : State . baseURL . replace ( new RegExp ( `\\/ ${ process . env . ACCOUNT_HANDLE } $` ) , `/${ handle } ` ) ,
155+ baseURL : State . baseURL . replace ( pattern , `/${ handle } ` ) ,
151156 token : State . token_global ,
152157 } ) ) [ method . toLowerCase ( ) ] ( stub . tid ( ) , method === 'PUT' ? stub . document ( ) : undefined ) ;
153158 expect ( res . status ) . to . be . oneOf ( [ 401 , 403 ] ) ;
You can’t perform that action at this time.
0 commit comments