diff --git a/test/unit/lib/plugins/milestones.test.js b/test/unit/lib/plugins/milestones.test.js index 24061feeb..c08bab38d 100644 --- a/test/unit/lib/plugins/milestones.test.js +++ b/test/unit/lib/plugins/milestones.test.js @@ -1,22 +1,24 @@ const { getLog } = require('probot/lib/helpers/get-log') const Milestones = require('../../../../lib/plugins/milestones') -describe.skip('Milestones', () => { +describe('Milestones', () => { let github const log = getLog() log.level = process.env.LOG_LEVEL ?? 'info' function configure (config) { - return new Milestones(github, { owner: 'bkeepers', repo: 'test' }, config) + const noop = false + const errors = [] + return new Milestones(noop, github, { owner: 'bkeepers', repo: 'test' }, config, log, errors) } beforeEach(() => { github = { - paginate: jest.fn().mockImplementation(() => Promise.resolve()), + paginate: jest.fn().mockResolvedValue({}), issues: { - listMilestonesForRepo: { + listMilestones: { endpoint: { - merge: jest.fn().mockImplementation(() => {}) + merge: jest.fn().mockImplementation(() => ({ route: 'GET /repos/{owner}/{repo}/milestones' })) } }, createMilestone: jest.fn().mockImplementation(() => Promise.resolve()), @@ -28,12 +30,12 @@ describe.skip('Milestones', () => { describe('sync', () => { it('syncs milestones', async () => { - github.paginate.mockReturnValueOnce(Promise.resolve([ + github.paginate.mockResolvedValueOnce([ { title: 'no-change', description: 'no-change-description', due_on: null, state: 'open', number: 5 }, { title: 'new-description', description: 'old-description', due_on: null, state: 'open', number: 2 }, { title: 'new-state', description: 'FF0000', due_on: null, state: 'open', number: 4 }, { title: 'remove-milestone', description: 'old-description', due_on: null, state: 'open', number: 1 } - ])) + ]) const plugin = configure([ { title: 'no-change', description: 'no-change-description', due_on: '2019-03-29T07:00:00Z', state: 'open' },