File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -688,6 +688,19 @@ test('should get user by username', async () => {
688688 expect ( got . mock . calls [ 0 ] ) . toMatchSnapshot ( ) ;
689689} ) ;
690690
691+ test ( 'should get user by username fail when api fails' , async ( ) => {
692+ const api = new SauceLabs ( { user : 'foo' , key : 'bar' } ) ;
693+ got . mockReturnValue ( Promise . reject ( new Error ( 'example' ) ) ) ;
694+ const error = await api
695+ . getUserByUsername ( { username : 'fooUser' } )
696+ . catch ( ( err ) => err ) ;
697+ expect ( error ) . toEqual (
698+ new Error (
699+ 'There was an error while fetching user information: Failed calling getUsersV1: example, undefined'
700+ )
701+ ) ;
702+ } ) ;
703+
691704test ( 'should get list of builds' , async ( ) => {
692705 const api = new SauceLabs ( { user : 'foo' , key : 'bar' } ) ;
693706 got
You can’t perform that action at this time.
0 commit comments