@@ -284,9 +284,9 @@ describe('user.controller > auth management', () => {
284284 expect ( fakeUser . resetPasswordExpires ) . toBeUndefined ( ) ;
285285 expect ( fakeUser . save ) . toHaveBeenCalled ( ) ;
286286 } ) ;
287- // it('returns a success response with the sanitised user', () => {
288- // expect(response.json).toHaveBeenCalledWith({ success: true });
289- // });
287+ it ( 'returns a success response with the sanitised user' , ( ) => {
288+ expect ( response . json ) . toHaveBeenCalledWith ( { success : true } ) ;
289+ } ) ;
290290 } ) ;
291291 } ) ;
292292
@@ -349,22 +349,22 @@ describe('user.controller > auth management', () => {
349349 } ) ;
350350 } ) ;
351351
352- // describe('and when there is an email in the request', () => {
353- // beforeEach(async () => {
354- // request.setBody({
355- // username: 'oldusername',
356- // email: 'new@email.com'
357- // });
358- // await updateSettings(request, response);
359- // });
360- // it('calls saveUser with the new email', () => {
361- // expect(saveUser).toHaveBeenCalledWith(response, {
362- // ...startingUser,
363- // email: 'new@email.com'
364- // });
365- // });
366- // it('sends an email to confirm the email update', () => {});
367- // });
352+ describe ( 'and when there is an email in the request' , ( ) => {
353+ beforeEach ( async ( ) => {
354+ request . setBody ( {
355+ username : 'oldusername' ,
356+ email : 'new@email.com'
357+ } ) ;
358+ await updateSettings ( request , response , next ) ;
359+ } ) ;
360+ it ( 'calls saveUser with the new email' , ( ) => {
361+ expect ( saveUser ) . toHaveBeenCalledWith ( response , {
362+ ...startingUser ,
363+ email : 'new@email.com'
364+ } ) ;
365+ } ) ;
366+ it ( 'sends an email to confirm the email update' , ( ) => { } ) ;
367+ } ) ;
368368
369369 // currently frontend doesn't seem to call the below
370370 describe ( 'and when there is a newPassword in the request' , ( ) => {
0 commit comments