Skip to content

Commit

Permalink
fix broken milestones test
Browse files Browse the repository at this point in the history
  • Loading branch information
Gramatus committed Sep 15, 2024
1 parent 7609c94 commit da1dd48
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions test/unit/lib/plugins/milestones.test.js
Original file line number Diff line number Diff line change
@@ -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()),
Expand All @@ -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' },
Expand Down

0 comments on commit da1dd48

Please sign in to comment.