'use strict' ; import assert from 'power-assert' ; import { prepareLuaTest } from '../LuaTestUtil' ; describe ( 'issue_reminder component' , ( ) => { let luaVmWrapper ; before ( async ( ) => { luaVmWrapper = await prepareLuaTest ( __dirname , { injectMap : new Map ( ) . set ( 'getData' , ( ) => ( { issues : [ { author : 'author' , number : 1 , createdAt : 0 , closedAt : null , comments : [ ] , labels : [ ] , } , { author : 'author' , number : 2 , createdAt : 0 , closedAt : 0 , comments : [ ] , labels : [ ] , } , { author : 'author' , number : 3 , createdAt : 0 , closedAt : null , comments : [ { id : 1 , } , ] , labels : [ ] , } , { author : 'author' , number : 4 , createdAt : new Date ( ) . getTime ( ) , closedAt : null , comments : [ ] , labels : [ ] , } , { author : 'replier1' , number : 5 , createdAt : 0 , closedAt : null , comments : [ ] , labels : [ ] , } , { author : 'author' , number : 6 , createdAt : 0 , closedAt : null , comments : [ ] , labels : [ ] , } , { author : 'author' , number : 7 , createdAt : 0 , closedAt : null , comments : [ ] , labels : [ 'bug' , 'weekly-report' ] , } , ] , } ) ) . set ( 'getRoles' , ( ) => [ 'replier1' , 'replier2' , ] ) . set ( 'toNow' , time => { return new Date ( ) . getTime ( ) - new Date ( time ) . getTime ( ) ; } ) , } ) ; } ) ; afterEach ( ( ) => { luaVmWrapper . clean ( ) ; } ) ; describe ( 'issue reminder' , ( ) => { it ( 'only remind specific issue' , async ( ) => { const result = luaVmWrapper . invoke ( 'Issue reminder' ) ; assert . deepStrictEqual ( result , [ [ 'addIssueComment' , 1 , 'This issue has not been replied for 24 hours, please pay attention to this issue: @replier1 @replier2 ' ] , [ 'addIssueComment' , 6 , 'This issue has not been replied for 24 hours, please pay attention to this issue: @replier1 @replier2 ' ] , ] ) ; } ) ; } ) ; } ) ;