From b1c848b69258c9512b92a0ad62f4f9f668ffdbd7 Mon Sep 17 00:00:00 2001 From: Saugat Acharya Date: Mon, 11 Mar 2024 14:56:52 +0545 Subject: [PATCH] test: update nock mocks --- scheduler/test.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/scheduler/test.js b/scheduler/test.js index 2bd01235..a979dac7 100644 --- a/scheduler/test.js +++ b/scheduler/test.js @@ -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 @@ -23,7 +22,7 @@ describe('Schedules intervals for a repository', () => { createScheduler(probot) }) - it('gets a page of repositories', async () => { + test('gets a page of repositories', async () => { nock('https://api.github.com') .get('/app/installations') .query({ per_page: 1 }) @@ -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() + }) })