1
1
const { getLog } = require ( 'probot/lib/helpers/get-log' )
2
2
const Milestones = require ( '../../../../lib/plugins/milestones' )
3
3
4
- describe . skip ( 'Milestones' , ( ) => {
4
+ describe ( 'Milestones' , ( ) => {
5
5
let github
6
6
7
7
const log = getLog ( )
8
8
log . level = process . env . LOG_LEVEL ?? 'info'
9
9
function configure ( config ) {
10
- return new Milestones ( github , { owner : 'bkeepers' , repo : 'test' } , config )
10
+ const noop = false
11
+ const errors = [ ]
12
+ return new Milestones ( noop , github , { owner : 'bkeepers' , repo : 'test' } , config , log , errors )
11
13
}
12
14
13
15
beforeEach ( ( ) => {
14
16
github = {
15
- paginate : jest . fn ( ) . mockImplementation ( ( ) => Promise . resolve ( ) ) ,
17
+ paginate : jest . fn ( ) . mockResolvedValue ( { } ) ,
16
18
issues : {
17
- listMilestonesForRepo : {
19
+ listMilestones : {
18
20
endpoint : {
19
- merge : jest . fn ( ) . mockImplementation ( ( ) => { } )
21
+ merge : jest . fn ( ) . mockImplementation ( ( ) => ( { route : 'GET /repos/{owner}/{repo}/milestones' } ) )
20
22
}
21
23
} ,
22
24
createMilestone : jest . fn ( ) . mockImplementation ( ( ) => Promise . resolve ( ) ) ,
@@ -28,12 +30,12 @@ describe.skip('Milestones', () => {
28
30
29
31
describe ( 'sync' , ( ) => {
30
32
it ( 'syncs milestones' , async ( ) => {
31
- github . paginate . mockReturnValueOnce ( Promise . resolve ( [
33
+ github . paginate . mockResolvedValueOnce ( [
32
34
{ title : 'no-change' , description : 'no-change-description' , due_on : null , state : 'open' , number : 5 } ,
33
35
{ title : 'new-description' , description : 'old-description' , due_on : null , state : 'open' , number : 2 } ,
34
36
{ title : 'new-state' , description : 'FF0000' , due_on : null , state : 'open' , number : 4 } ,
35
37
{ title : 'remove-milestone' , description : 'old-description' , due_on : null , state : 'open' , number : 1 }
36
- ] ) )
38
+ ] )
37
39
38
40
const plugin = configure ( [
39
41
{ title : 'no-change' , description : 'no-change-description' , due_on : '2019-03-29T07:00:00Z' , state : 'open' } ,
0 commit comments