import { Callback } from "aws-lambda" ; import { mock , restore } from "aws-sdk-mock" ; param spy return function mockCognitoSignUp ( spy ) { mock ( "CognitoIdentityServiceProvider" , "signUp" , ( data , cb ) => { cb ( undefined , spy ( data ) ) ; } ) ; return spy ; } return export function mockCognitoSignUpWithSuccess ( ) { return mockCognitoSignUp ( jasmine . createSpy ( "signUp" ) ) ; } param err return export function mockCognitoSignUpWithError ( err = new Error ( "signUp" ) ) { return mockCognitoSignUp ( jasmine . createSpy ( "signUp" ) . and . callFake ( ( ) => { throw err ; } ) ) ; } /**
 * Restore `CognitoIdentityServiceProvider.signUp`
 */ export function restoreCognitoSignUp ( ) { restore ( "CognitoIdentityServiceProvider" , "signUp" ) ; }