'use strict' ; import { Application , Agent } from 'egg' ; import { prepareTestApplication , testClear , waitFor } from '../../Util' ; import { initWebhooks , sendToWebhooks , getPayload } from '../../plugin/github/GitHubTestUtil' ; import assert from 'power-assert' ; describe ( 'Vote Integration Test' , ( ) => { let app ; let agent ; let testResult ; before ( async ( ) => { ( { app , agent } = await prepareTestApplication ( ) ) ; testResult = await initWebhooks ( app ) ; } ) ; after ( ( ) => { testClear ( app , agent ) ; } ) ; it ( 'start a vote' , async ( ) => { await sendToWebhooks ( app , 'issue_comment.edited' , { ... getPayload ( 'issue_comment.edited' ) , issue : { number : 1 , } , comment : { user : { login : 'liwen-tj' , } , url : '' , body : '/start-vote a,b,c,d anyone 1d' , } , } ) ; await waitFor ( 30 ) ; assert . deepStrictEqual ( testResult , [ ] ) ; } ) ; it ( 'vote' , async ( ) => { await sendToWebhooks ( app , 'issue_comment.edited' , { ... getPayload ( 'issue_comment.edited' ) , issue : { number : 1 , } , comment : { user : { login : 'liwen-tj' , } , url : '' , body : '/vote a' , } , } ) ; await waitFor ( 30 ) ; assert . deepStrictEqual ( testResult , [ ] ) ; } ) ; } ) ;