Skip to content

Commit

Permalink
test: update nock mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
mesaugat committed Mar 11, 2024
1 parent 6eb5157 commit 00f4526
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions scheduler/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ const { Probot, ProbotOctokit } = require('probot')

const payload = require('./fixtures/installation-created.json')

nock.disableNetConnect()

describe('Schedules intervals for a repository', () => {
let probot

beforeEach(() => {
nock.disableNetConnect()
probot = new Probot({
githubToken: 'test',
// Disable throttling & retrying requests for easier testing
Expand All @@ -37,13 +36,20 @@ describe('Schedules intervals for a repository', () => {
.persist()

nock('https://api.github.com')
.get('/app/installations?per_page=100')
.get('/app/installations')
.query({ per_page: 100 })
.reply(200, [{ account: { login: 'testUser' } }])

nock('https://api.github.com')
.get('/installation/repositories?per_page=100')
.get('/installation/repositories')
.query({ per_page: 100 })
.reply(200, [{ id: 2 }])

await probot.receive({ name: 'installation', payload })
})

afterEach(() => {
nock.cleanAll()
nock.enableNetConnect()
})
})

0 comments on commit 00f4526

Please sign in to comment.