Skip to content

Commit 8e3c7df

Browse files
committed
fix broken milestones test
1 parent 055a5c6 commit 8e3c7df

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

test/unit/lib/plugins/milestones.test.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
const { getLog } = require('probot/lib/helpers/get-log')
22
const Milestones = require('../../../../lib/plugins/milestones')
33

4-
describe.skip('Milestones', () => {
4+
describe('Milestones', () => {
55
let github
66

77
const log = getLog()
88
log.level = process.env.LOG_LEVEL ?? 'info'
99
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)
1113
}
1214

1315
beforeEach(() => {
1416
github = {
15-
paginate: jest.fn().mockImplementation(() => Promise.resolve()),
17+
paginate: jest.fn().mockResolvedValue({}),
1618
issues: {
17-
listMilestonesForRepo: {
19+
listMilestones: {
1820
endpoint: {
19-
merge: jest.fn().mockImplementation(() => {})
21+
merge: jest.fn().mockImplementation(() => ({ route: 'GET /repos/{owner}/{repo}/milestones' }))
2022
}
2123
},
2224
createMilestone: jest.fn().mockImplementation(() => Promise.resolve()),
@@ -28,12 +30,12 @@ describe.skip('Milestones', () => {
2830

2931
describe('sync', () => {
3032
it('syncs milestones', async () => {
31-
github.paginate.mockReturnValueOnce(Promise.resolve([
33+
github.paginate.mockResolvedValueOnce([
3234
{ title: 'no-change', description: 'no-change-description', due_on: null, state: 'open', number: 5 },
3335
{ title: 'new-description', description: 'old-description', due_on: null, state: 'open', number: 2 },
3436
{ title: 'new-state', description: 'FF0000', due_on: null, state: 'open', number: 4 },
3537
{ title: 'remove-milestone', description: 'old-description', due_on: null, state: 'open', number: 1 }
36-
]))
38+
])
3739

3840
const plugin = configure([
3941
{ title: 'no-change', description: 'no-change-description', due_on: '2019-03-29T07:00:00Z', state: 'open' },

0 commit comments

Comments
 (0)