From 6c3eb3e321ed1f8adae07fad977cbd7796db1659 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Tue, 19 May 2020 09:31:11 +0200 Subject: [PATCH] chore: fix lint warnings --- .../__snapshots__/index.spec.ts.snap | 48 +++++++++++++++++ lib/platform/bitbucket-server/index.spec.ts | 29 ++++++----- .../__snapshots__/index.spec.ts.snap | 24 +++++++++ lib/platform/bitbucket/index.spec.ts | 51 +++++++++++-------- .../gitlab/__snapshots__/index.spec.ts.snap | 6 +++ lib/platform/gitlab/index.spec.ts | 7 ++- 6 files changed, 127 insertions(+), 38 deletions(-) diff --git a/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap b/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap index 9505c71697..d1f24607eb 100644 --- a/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap +++ b/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap @@ -1,5 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`platform/bitbucket-server endpoint with no path addAssignees() does not throw 1`] = `undefined`; + +exports[`platform/bitbucket-server endpoint with no path addReviewers does not throw 1`] = `undefined`; + exports[`platform/bitbucket-server endpoint with no path addReviewers sends the reviewer name as a reviewer 1`] = ` Array [ Array [ @@ -246,6 +250,8 @@ Array [ ] `; +exports[`platform/bitbucket-server endpoint with no path branchExists() getFileList() sends to gitFs 1`] = `true`; + exports[`platform/bitbucket-server endpoint with no path commitFiles() sends to gitFs 1`] = ` Array [ Array [ @@ -349,6 +355,10 @@ Array [ ] `; +exports[`platform/bitbucket-server endpoint with no path deleteBranch() sends to gitFs 1`] = `undefined`; + +exports[`platform/bitbucket-server endpoint with no path deleteLAbel() does not throw 1`] = `undefined`; + exports[`platform/bitbucket-server endpoint with no path ensureComment() add comment if not found 1`] = ` Array [ Array [ @@ -538,6 +548,10 @@ Array [ ] `; +exports[`platform/bitbucket-server endpoint with no path getAllRenovateBranches() sends to gitFs 1`] = `undefined`; + +exports[`platform/bitbucket-server endpoint with no path getBranchLastCommitTime() sends to gitFs 1`] = `undefined`; + exports[`platform/bitbucket-server endpoint with no path getBranchPr() has no pr 1`] = ` Array [ Array [ @@ -745,6 +759,12 @@ Array [ ] `; +exports[`platform/bitbucket-server endpoint with no path getCommitMessages() sends to gitFs 1`] = `undefined`; + +exports[`platform/bitbucket-server endpoint with no path getFile() sends to gitFs 1`] = `undefined`; + +exports[`platform/bitbucket-server endpoint with no path getFileList() sends to gitFs 1`] = `undefined`; + exports[`platform/bitbucket-server endpoint with no path getPr() canRebase 1`] = ` Object { "body": "* Line 1 @@ -1055,6 +1075,10 @@ Object { } `; +exports[`platform/bitbucket-server endpoint with no path isBranchStale() sends to gitFs 1`] = `false`; + +exports[`platform/bitbucket-server endpoint with no path mergeBranch() sends to gitFs 1`] = `undefined`; + exports[`platform/bitbucket-server endpoint with no path mergePr() posts Merge 1`] = ` Array [ Array [ @@ -1579,6 +1603,10 @@ Array [ ] `; +exports[`platform/bitbucket-server endpoint with path addAssignees() does not throw 1`] = `undefined`; + +exports[`platform/bitbucket-server endpoint with path addReviewers does not throw 1`] = `undefined`; + exports[`platform/bitbucket-server endpoint with path addReviewers sends the reviewer name as a reviewer 1`] = ` Array [ Array [ @@ -1825,6 +1853,8 @@ Array [ ] `; +exports[`platform/bitbucket-server endpoint with path branchExists() getFileList() sends to gitFs 1`] = `true`; + exports[`platform/bitbucket-server endpoint with path commitFiles() sends to gitFs 1`] = ` Array [ Array [ @@ -1928,6 +1958,10 @@ Array [ ] `; +exports[`platform/bitbucket-server endpoint with path deleteBranch() sends to gitFs 1`] = `undefined`; + +exports[`platform/bitbucket-server endpoint with path deleteLAbel() does not throw 1`] = `undefined`; + exports[`platform/bitbucket-server endpoint with path ensureComment() add comment if not found 1`] = ` Array [ Array [ @@ -2117,6 +2151,10 @@ Array [ ] `; +exports[`platform/bitbucket-server endpoint with path getAllRenovateBranches() sends to gitFs 1`] = `undefined`; + +exports[`platform/bitbucket-server endpoint with path getBranchLastCommitTime() sends to gitFs 1`] = `undefined`; + exports[`platform/bitbucket-server endpoint with path getBranchPr() has no pr 1`] = ` Array [ Array [ @@ -2324,6 +2362,12 @@ Array [ ] `; +exports[`platform/bitbucket-server endpoint with path getCommitMessages() sends to gitFs 1`] = `undefined`; + +exports[`platform/bitbucket-server endpoint with path getFile() sends to gitFs 1`] = `undefined`; + +exports[`platform/bitbucket-server endpoint with path getFileList() sends to gitFs 1`] = `undefined`; + exports[`platform/bitbucket-server endpoint with path getPr() canRebase 1`] = ` Object { "body": "* Line 1 @@ -2634,6 +2678,10 @@ Object { } `; +exports[`platform/bitbucket-server endpoint with path isBranchStale() sends to gitFs 1`] = `false`; + +exports[`platform/bitbucket-server endpoint with path mergeBranch() sends to gitFs 1`] = `undefined`; + exports[`platform/bitbucket-server endpoint with path mergePr() posts Merge 1`] = ` Array [ Array [ diff --git a/lib/platform/bitbucket-server/index.spec.ts b/lib/platform/bitbucket-server/index.spec.ts index acd4677d4d..13d27fe513 100644 --- a/lib/platform/bitbucket-server/index.spec.ts +++ b/lib/platform/bitbucket-server/index.spec.ts @@ -1,5 +1,4 @@ // TODO fix mocks -/* eslint jest/expect-expect: 1 */ import { REPOSITORY_CHANGED, REPOSITORY_DISABLED, @@ -233,7 +232,7 @@ describe('platform/bitbucket-server', () => { describe('getFileList()', () => { it('sends to gitFs', async () => { await initRepo(); - await bitbucket.getFileList(); + expect(await bitbucket.getFileList()).toMatchSnapshot(); }); }); @@ -241,7 +240,9 @@ describe('platform/bitbucket-server', () => { describe('getFileList()', () => { it('sends to gitFs', async () => { await initRepo(); - await bitbucket.branchExists(undefined as any); + expect( + await bitbucket.branchExists(undefined as any) + ).toMatchSnapshot(); }); }); }); @@ -249,21 +250,23 @@ describe('platform/bitbucket-server', () => { describe('isBranchStale()', () => { it('sends to gitFs', async () => { await initRepo(); - await bitbucket.isBranchStale(undefined as any); + expect( + await bitbucket.isBranchStale(undefined as any) + ).toMatchSnapshot(); }); }); describe('deleteBranch()', () => { it('sends to gitFs', async () => { await initRepo(); - await bitbucket.deleteBranch('branch'); + expect(await bitbucket.deleteBranch('branch')).toMatchSnapshot(); }); }); describe('mergeBranch()', () => { it('sends to gitFs', async () => { await initRepo(); - await bitbucket.mergeBranch('branch'); + expect(await bitbucket.mergeBranch('branch')).toMatchSnapshot(); }); }); @@ -283,34 +286,34 @@ describe('platform/bitbucket-server', () => { describe('getFile()', () => { it('sends to gitFs', async () => { await initRepo(); - await bitbucket.getFile('', ''); + expect(await bitbucket.getFile('', '')).toMatchSnapshot(); }); }); describe('getAllRenovateBranches()', () => { it('sends to gitFs', async () => { await initRepo(); - await bitbucket.getAllRenovateBranches(''); + expect(await bitbucket.getAllRenovateBranches('')).toMatchSnapshot(); }); }); describe('getBranchLastCommitTime()', () => { it('sends to gitFs', async () => { await initRepo(); - await bitbucket.getBranchLastCommitTime(''); + expect(await bitbucket.getBranchLastCommitTime('')).toMatchSnapshot(); }); }); describe('addAssignees()', () => { it('does not throw', async () => { - await bitbucket.addAssignees(3, ['some']); + expect(await bitbucket.addAssignees(3, ['some'])).toMatchSnapshot(); }); }); describe('addReviewers', () => { it('does not throw', async () => { await initRepo(); - await bitbucket.addReviewers(5, ['name']); + expect(await bitbucket.addReviewers(5, ['name'])).toMatchSnapshot(); }); it('sends the reviewer name as a reviewer', async () => { @@ -379,7 +382,7 @@ describe('platform/bitbucket-server', () => { describe('deleteLAbel()', () => { it('does not throw', async () => { - await bitbucket.deleteLabel(5, 'renovate'); + expect(await bitbucket.deleteLabel(5, 'renovate')).toMatchSnapshot(); }); }); @@ -829,7 +832,7 @@ Followed by some information. describe('getCommitMessages()', () => { it('sends to gitFs', async () => { await initRepo(); - await bitbucket.getCommitMessages(); + expect(await bitbucket.getCommitMessages()).toMatchSnapshot(); }); }); diff --git a/lib/platform/bitbucket/__snapshots__/index.spec.ts.snap b/lib/platform/bitbucket/__snapshots__/index.spec.ts.snap index 4a6998fbd5..07c808a839 100644 --- a/lib/platform/bitbucket/__snapshots__/index.spec.ts.snap +++ b/lib/platform/bitbucket/__snapshots__/index.spec.ts.snap @@ -1,5 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`platform/bitbucket addAssignees() does not throw 1`] = `undefined`; + exports[`platform/bitbucket addReviewers should add the given reviewers to the PR 1`] = ` Array [ Array [ @@ -21,6 +23,8 @@ Array [ ] `; +exports[`platform/bitbucket commitFiles() sends to gitFs 1`] = `undefined`; + exports[`platform/bitbucket createPr() posts PR 1`] = ` Array [ Array [ @@ -51,6 +55,8 @@ Array [ ] `; +exports[`platform/bitbucket deleteBranch() sends to gitFs 1`] = `undefined`; + exports[`platform/bitbucket deleteBranch() should handle closing PRs when none exist 1`] = `Array []`; exports[`platform/bitbucket deleteBranch() should handle closing PRs when some exist 1`] = ` @@ -61,6 +67,10 @@ Array [ ] `; +exports[`platform/bitbucket ensureComment() does not throw 1`] = `false`; + +exports[`platform/bitbucket ensureCommentRemoval() does not throw 1`] = `undefined`; + exports[`platform/bitbucket ensureIssue() creates new issue 1`] = ` Array [ Array [ @@ -144,6 +154,10 @@ Object { } `; +exports[`platform/bitbucket getAllRenovateBranches() sends to gitFs 1`] = `undefined`; + +exports[`platform/bitbucket getBranchLastCommitTime() sends to gitFs 1`] = `undefined`; + exports[`platform/bitbucket getBranchPr() bitbucket finds PR for branch 1`] = ` Object { "body": "summary", @@ -161,6 +175,10 @@ Object { } `; +exports[`platform/bitbucket getCommitMessages() sends to gitFs 1`] = `undefined`; + +exports[`platform/bitbucket getFile() sends to gitFs 1`] = `undefined`; + exports[`platform/bitbucket getPr() canRebase 1`] = ` Object { "body": "summary", @@ -278,6 +296,8 @@ Array [ ] `; +exports[`platform/bitbucket getRepoStatus() sends to gitFs 1`] = `undefined`; + exports[`platform/bitbucket initPlatform() should init 1`] = ` Object { "endpoint": "https://api.bitbucket.org/", @@ -291,6 +311,10 @@ Object { } `; +exports[`platform/bitbucket isBranchStale() sends to gitFs 1`] = `false`; + +exports[`platform/bitbucket mergeBranch() sends to gitFs 1`] = `undefined`; + exports[`platform/bitbucket mergePr() posts Merge 1`] = ` Array [ Array [ diff --git a/lib/platform/bitbucket/index.spec.ts b/lib/platform/bitbucket/index.spec.ts index b4a85248ca..118372a6e4 100644 --- a/lib/platform/bitbucket/index.spec.ts +++ b/lib/platform/bitbucket/index.spec.ts @@ -1,5 +1,4 @@ // TODO fix mocks -/* eslint jest/expect-expect: 1 */ import URL from 'url'; import { REPOSITORY_DISABLED } from '../../constants/error-messages'; import { logger as _logger } from '../../logger'; @@ -180,7 +179,7 @@ describe('platform/bitbucket', () => { it('sends to gitFs', async () => { await initRepo(); await mocked(async () => { - await bitbucket.isBranchStale('test'); + expect(await bitbucket.isBranchStale('test')).toMatchSnapshot(); }); }); }); @@ -246,7 +245,7 @@ describe('platform/bitbucket', () => { it('sends to gitFs', async () => { await initRepo(); await mocked(async () => { - await bitbucket.getRepoStatus(); + expect(await bitbucket.getRepoStatus()).toMatchSnapshot(); }); }); }); @@ -255,7 +254,7 @@ describe('platform/bitbucket', () => { it('sends to gitFs', async () => { await initRepo(); await mocked(async () => { - await bitbucket.deleteBranch('test'); + expect(await bitbucket.deleteBranch('test')).toMatchSnapshot(); }); }); it('should handle closing PRs when none exist', async () => { @@ -278,7 +277,7 @@ describe('platform/bitbucket', () => { it('sends to gitFs', async () => { await initRepo(); await mocked(async () => { - await bitbucket.mergeBranch('test'); + expect(await bitbucket.mergeBranch('test')).toMatchSnapshot(); }); }); }); @@ -287,7 +286,9 @@ describe('platform/bitbucket', () => { it('sends to gitFs', async () => { await initRepo(); await mocked(async () => { - await bitbucket.getBranchLastCommitTime('test'); + expect( + await bitbucket.getBranchLastCommitTime('test') + ).toMatchSnapshot(); }); }); }); @@ -355,7 +356,7 @@ describe('platform/bitbucket', () => { describe('addAssignees()', () => { it('does not throw', async () => { - await bitbucket.addAssignees(3, ['some']); + expect(await bitbucket.addAssignees(3, ['some'])).toMatchSnapshot(); }); }); @@ -371,17 +372,21 @@ describe('platform/bitbucket', () => { describe('ensureComment()', () => { it('does not throw', async () => { - await bitbucket.ensureComment({ - number: 3, - topic: 'topic', - content: 'content', - }); + expect( + await bitbucket.ensureComment({ + number: 3, + topic: 'topic', + content: 'content', + }) + ).toMatchSnapshot(); }); }); describe('ensureCommentRemoval()', () => { it('does not throw', async () => { - await bitbucket.ensureCommentRemoval({ number: 3, topic: 'topic' }); + expect( + await bitbucket.ensureCommentRemoval({ number: 3, topic: 'topic' }) + ).toMatchSnapshot(); }); }); @@ -494,11 +499,13 @@ describe('platform/bitbucket', () => { it('sends to gitFs', async () => { await initRepo(); await mocked(async () => { - await bitbucket.commitFiles({ - branchName: 'test', - files: [], - message: 'message', - }); + expect( + await bitbucket.commitFiles({ + branchName: 'test', + files: [], + message: 'message', + }) + ).toMatchSnapshot(); }); }); }); @@ -507,7 +514,7 @@ describe('platform/bitbucket', () => { it('sends to gitFs', async () => { await initRepo(); await mocked(async () => { - await bitbucket.getFile('test.file'); + expect(await bitbucket.getFile('test.file')).toMatchSnapshot(); }); }); }); @@ -516,7 +523,7 @@ describe('platform/bitbucket', () => { it('sends to gitFs', async () => { await initRepo(); await mocked(async () => { - await bitbucket.getCommitMessages(); + expect(await bitbucket.getCommitMessages()).toMatchSnapshot(); }); }); }); @@ -525,7 +532,9 @@ describe('platform/bitbucket', () => { it('sends to gitFs', async () => { await initRepo(); await mocked(async () => { - await bitbucket.getAllRenovateBranches('test'); + expect( + await bitbucket.getAllRenovateBranches('test') + ).toMatchSnapshot(); }); }); }); diff --git a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap index 7fd9d13874..a4d391bed3 100644 --- a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap +++ b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap @@ -175,6 +175,8 @@ Array [ ] `; +exports[`platform/gitlab cleanRepo() exists 1`] = `undefined`; + exports[`platform/gitlab commitFiles() sends to gitFs 1`] = ` Array [ Object { @@ -1468,6 +1470,10 @@ Array [ ] `; +exports[`platform/gitlab getCommitMessages() passes to git 1`] = `undefined`; + +exports[`platform/gitlab getFile() sends to gitFs 1`] = `undefined`; + exports[`platform/gitlab getFileList() sends to gitFs 1`] = ` Array [ Object { diff --git a/lib/platform/gitlab/index.spec.ts b/lib/platform/gitlab/index.spec.ts index b54eb619a1..4f05b32079 100644 --- a/lib/platform/gitlab/index.spec.ts +++ b/lib/platform/gitlab/index.spec.ts @@ -1,5 +1,4 @@ // TODO fix mocks -/* eslint jest/expect-expect: 1 */ import nock from 'nock'; import { Platform, RepoParams } from '..'; import * as httpMock from '../../../test/httpMock'; @@ -174,7 +173,7 @@ describe('platform/gitlab', () => { }); describe('cleanRepo()', () => { it('exists', async () => { - await gitlab.cleanRepo(); + expect(await gitlab.cleanRepo()).toMatchSnapshot(); }); }); @@ -1253,7 +1252,7 @@ These updates have all been created already. Click a checkbox below to force a r describe('getFile()', () => { it('sends to gitFs', async () => { await initRepo(); - await gitlab.getFile(''); + expect(await gitlab.getFile('')).toMatchSnapshot(); }); }); describe('commitFiles()', () => { @@ -1271,7 +1270,7 @@ These updates have all been created already. Click a checkbox below to force a r describe('getCommitMessages()', () => { it('passes to git', async () => { await initRepo(); - await gitlab.getCommitMessages(); + expect(await gitlab.getCommitMessages()).toMatchSnapshot(); }); }); describe('getVulnerabilityAlerts()', () => { -- GitLab