@@ -88,7 +88,7 @@ describe('Handler', () => {
8888    expect ( response . emailMessage ) . toStrictEqual ( expected ) ; 
8989  } ) ; 
9090
91-   it ( 'should throw an error  on user confirmed' ,  async  ( )  =>  { 
91+   it ( 'should log a warning and return the event  on user confirmed' ,  async  ( )  =>  { 
9292    const  event  =  makeEvent ( ) ; 
9393    const  userVerifiedEvent  =  { 
9494      ...event , 
@@ -102,13 +102,22 @@ describe('Handler', () => {
102102      } , 
103103    } ; 
104104
105-     // eslint-disable-next-line functional/no-try-statements 
106-     try  { 
107-       await  makeHandler ( env ) ( userVerifiedEvent ) ; 
108-       fail ( 'Should not reach this point' ) ; 
109-     }  catch  ( error )  { 
110-       expect ( error ) . toStrictEqual ( new  Error ( 'Operation not permitted' ) ) ; 
111-     } 
105+     // Spy on console.warn 
106+     const  consoleWarnSpy  =  jest . spyOn ( console ,  'warn' ) . mockImplementation ( ) ; 
107+ 
108+     const  result  =  await  makeHandler ( env ) ( userVerifiedEvent ) ; 
109+ 
110+     const  username  =  event . request . userAttributes [ 'sub' ] ; 
111+     // Verify that the warning was logged 
112+     expect ( consoleWarnSpy ) . toHaveBeenCalledWith ( 
113+       `User ${ username }  
114+     ) ; 
115+ 
116+     // Verify that the event is returned unmodified 
117+     expect ( result ) . toStrictEqual ( userVerifiedEvent ) ; 
118+ 
119+     // Restore the original console.warn 
120+     consoleWarnSpy . mockRestore ( ) ; 
112121  } ) ; 
113122
114123  it ( 'should reply with verification link on UpdateUserAttribute event' ,  async  ( )  =>  { 
0 commit comments