'use strict' ; import { prepareTestApplication , testClear } from '../../Util' ; import { Application , Agent } from 'egg' ; describe ( 'IMManager' , ( ) => { let app ; let agent ; beforeEach ( async ( ) => { ( { app , agent } = await prepareTestApplication ( ) ) ; } ) ; afterEach ( ( ) => { testClear ( app , agent ) ; } ) ; describe ( 'sendToSlack' , ( ) => { it ( 'should not trigger send if slackConfig is undefined or null' , async ( ) => { await app . imManager . sendToSlack ( { } as any , undefined as any ) ; await app . imManager . sendToSlack ( { } as any , null as any ) ; } ) ; it ( 'should not trigger send if slackConfig.webhook is undefined or null' , async ( ) => { await app . imManager . sendToSlack ( { } as any , { } as any ) ; await app . imManager . sendToSlack ( { } as any , { name : '' , webhook : null } as any ) ; await app . imManager . sendToSlack ( { } as any , { name : '' , webhook : undefined } as any ) ; await app . imManager . sendToSlack ( { } as any , { name : '' , webhook : '' } as any ) ; } ) ; it ( 'should be error if slackConfig.webhook is incorrect' , async ( ) => { await app . imManager . sendToSlack ( { } as any , { name : '' , webhook : '123' } ) ; } ) ; } ) ; describe ( 'sendToDingTalk' , ( ) => { it ( 'should not trigger send if dingTalkConfig is undefined or null' , async ( ) => { await app . imManager . sendToDingTalk ( { } as any , undefined as any ) ; await app . imManager . sendToDingTalk ( { } as any , null as any ) ; } ) ; it ( 'should not trigger send if dingTalkConfig.webhook is undefined or null' , async ( ) => { await app . imManager . sendToDingTalk ( { } as any , { } as any ) ; await app . imManager . sendToDingTalk ( { } as any , { webhook : null } as any ) ; await app . imManager . sendToDingTalk ( { } as any , { webhook : undefined } as any ) ; await app . imManager . sendToDingTalk ( { } as any , { webhook : '' } as any ) ; } ) ; it ( 'should be error if dingTalkConfig.webhook is incorrect' , async ( ) => { await app . imManager . sendToDingTalk ( { } as any , { webhook : '123' } as any ) ; } ) ; } ) ; describe ( 'sendToMail' , ( ) => { it ( 'should not trigger send if mailConfig is incorrect' , async ( ) => { await app . imManager . sendToMail ( { } as any , undefined as any ) ; await app . imManager . sendToMail ( { } as any , null as any ) ; await app . imManager . sendToMail ( { } as any , { } as any ) ; await app . imManager . sendToMail ( { } as any , { connectOptions : { } } as any ) ; } ) ; } ) ; } ) ;