import { Callback } from "aws-lambda" ; import { mock , restore } from "aws-sdk-mock" ; param spy return function mockSNSPublish ( spy ) { mock ( "SNS" , "publish" , ( data , cb ) => { cb ( undefined , spy ( data ) ) ; } ) ; return spy ; } return export function mockSNSPublishWithSuccess ( ) { return mockSNSPublish ( jasmine . createSpy ( "publish" ) ) ; } param err return export function mockSNSPublishWithError ( err = new Error ( "publish" ) ) { return mockSNSPublish ( jasmine . createSpy ( "publish" ) . and . callFake ( ( ) => { throw err ; } ) ) ; } /**
 * Restore `SNS.publish`
 */ export function restoreSNSPublish ( ) { restore ( "SNS" , "publish" ) ; }