Skip to content

Commit

Permalink
Replace 'any' with PullsUpdateResponseData type
Browse files Browse the repository at this point in the history
  • Loading branch information
anarast committed Jan 27, 2021
1 parent 40a3722 commit 3f33b50
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
5 changes: 1 addition & 4 deletions src/autoupdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,7 @@ export class AutoUpdater {
return true;
}

async prNeedsUpdate(
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
pull: any,
): Promise<boolean> {
async prNeedsUpdate(pull: octokit.PullsUpdateResponseData): Promise<boolean> {
if (pull.merged === true) {
ghCore.warning('Skipping pull request, already merged.');
return false;
Expand Down
41 changes: 31 additions & 10 deletions test/autoupdate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if ('GITHUB_TOKEN' in process.env) {
import nock from 'nock';
import config from '../src/config-loader';
import { AutoUpdater } from '../src/autoupdater';
import { PullsUpdateResponseData } from '@octokit/types';

jest.mock('../src/config-loader');

Expand Down Expand Up @@ -67,7 +68,9 @@ describe('test `prNeedsUpdate`', () => {
};

const updater = new AutoUpdater(config, {});
const needsUpdate = await updater.prNeedsUpdate(pull);
const needsUpdate = await updater.prNeedsUpdate(
(pull as unknown) as PullsUpdateResponseData,
);
expect(needsUpdate).toEqual(false);
});

Expand All @@ -78,7 +81,9 @@ describe('test `prNeedsUpdate`', () => {
};

const updater = new AutoUpdater(config, {});
const needsUpdate = await updater.prNeedsUpdate(pull);
const needsUpdate = await updater.prNeedsUpdate(
(pull as unknown) as PullsUpdateResponseData,
);
expect(needsUpdate).toEqual(false);
});

Expand All @@ -91,7 +96,9 @@ describe('test `prNeedsUpdate`', () => {
},
});
const updater = new AutoUpdater(config, {});
const needsUpdate = await updater.prNeedsUpdate(pull);
const needsUpdate = await updater.prNeedsUpdate(
(pull as unknown) as PullsUpdateResponseData,
);
expect(needsUpdate).toEqual(false);
});

Expand All @@ -103,7 +110,9 @@ describe('test `prNeedsUpdate`', () => {
});

const updater = new AutoUpdater(config, {});
const needsUpdate = await updater.prNeedsUpdate(validPull);
const needsUpdate = await updater.prNeedsUpdate(
(validPull as unknown) as PullsUpdateResponseData,
);

expect(needsUpdate).toEqual(false);
expect(scope.isDone()).toEqual(true);
Expand All @@ -120,7 +129,9 @@ describe('test `prNeedsUpdate`', () => {
});

const updater = new AutoUpdater(config, {});
const needsUpdate = await updater.prNeedsUpdate(validPull);
const needsUpdate = await updater.prNeedsUpdate(
(validPull as unknown) as PullsUpdateResponseData,
);

expect(needsUpdate).toEqual(true);
expect(scope.isDone()).toEqual(true);
Expand Down Expand Up @@ -175,7 +186,9 @@ describe('test `prNeedsUpdate`', () => {
});

const updater = new AutoUpdater(config, {});
const needsUpdate = await updater.prNeedsUpdate(validPull);
const needsUpdate = await updater.prNeedsUpdate(
(validPull as unknown) as PullsUpdateResponseData,
);

expect(needsUpdate).toEqual(false);
expect(scope.isDone()).toEqual(true);
Expand Down Expand Up @@ -219,7 +232,9 @@ describe('test `prNeedsUpdate`', () => {
});

const updater = new AutoUpdater(config, {});
const needsUpdate = await updater.prNeedsUpdate(validPull);
const needsUpdate = await updater.prNeedsUpdate(
(validPull as unknown) as PullsUpdateResponseData,
);

expect(needsUpdate).toEqual(false);
expect(scope.isDone()).toEqual(true);
Expand Down Expand Up @@ -270,7 +285,9 @@ describe('test `prNeedsUpdate`', () => {
});

const updater = new AutoUpdater(config, {});
const needsUpdate = await updater.prNeedsUpdate(validPull);
const needsUpdate = await updater.prNeedsUpdate(
(validPull as unknown) as PullsUpdateResponseData,
);

expect(needsUpdate).toEqual(true);
expect(comparePr.isDone()).toEqual(true);
Expand All @@ -296,7 +313,9 @@ describe('test `prNeedsUpdate`', () => {
});

const updater = new AutoUpdater(config, {});
const needsUpdate = await updater.prNeedsUpdate(validPull);
const needsUpdate = await updater.prNeedsUpdate(
(validPull as unknown) as PullsUpdateResponseData,
);

expect(needsUpdate).toEqual(false);
expect(comparePr.isDone()).toEqual(true);
Expand All @@ -316,7 +335,9 @@ describe('test `prNeedsUpdate`', () => {
});

const updater = new AutoUpdater(config, {});
const needsUpdate = await updater.prNeedsUpdate(validPull);
const needsUpdate = await updater.prNeedsUpdate(
(validPull as unknown) as PullsUpdateResponseData,
);

expect(needsUpdate).toEqual(true);
expect(comparePr.isDone()).toEqual(true);
Expand Down

0 comments on commit 3f33b50

Please sign in to comment.