import { Callback } from "aws-lambda" ; import { mock , restore } from "aws-sdk-mock" ; import { chance } from "_/helpers" ; param spy return function mockCognitoAdminUpdateUserAttributes ( spy ) { mock ( "CognitoIdentityServiceProvider" , "adminUpdateUserAttributes" , ( data , cb ) => { cb ( undefined , spy ( data ) ) ; } ) ; return spy ; } param username return export function mockCognitoAdminUpdateUserAttributesWithSuccess ( username = chance . guid ( ) ) { return mockCognitoAdminUpdateUserAttributes ( jasmine . createSpy ( "adminUpdateUserAttributes" ) . and . returnValue ( { Username : username } ) ) ; } param err return export function mockCognitoAdminUpdateUserAttributesWithError ( err = new Error ( "adminUpdateUserAttributes" ) ) { return mockCognitoAdminUpdateUserAttributes ( jasmine . createSpy ( "adminUpdateUserAttributes" ) . and . callFake ( ( ) => { throw err ; } ) ) ; } /**
 * Restore `CognitoIdentityServiceProvider.adminUpdateUserAttributes`
 */ export function restoreCognitoAdminUpdateUserAttributes ( ) { restore ( "CognitoIdentityServiceProvider" , "adminUpdateUserAttributes" ) ; }