Skip to content
This repository was archived by the owner on Mar 30, 2022. It is now read-only.

Commit

Permalink
chore: cleanup lint from child dep type (#36)
Browse files Browse the repository at this point in the history
* chore(tests): add test for createComment util
  • Loading branch information
prescottprue authored Nov 24, 2021
1 parent de300e9 commit 303aa05
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 10 deletions.
22 changes: 22 additions & 0 deletions __tests__/comments.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as core from '@actions/core';
import { createComment } from '../src/comments';

jest.mock('@actions/github', () => ({
context: {
payload: {},
},
}));
jest.mock('@actions/core');

const mockCore = core as jest.Mocked<typeof core>;

describe('Comments utils', () => {
describe('createComment', () => {
it('Should exit with a warning if issue number is not found', async () => {
await createComment('');
expect(mockCore.warning).toHaveBeenCalledWith(
'Issue number not found. Impossible to create a comment',
);
});
});
});
2 changes: 2 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ module.exports = {
testEnvironment: 'node',
verbose: true,
collectCoverageFrom: ['src/**/*.ts'],
modulePathIgnorePatterns: ['dist'],
};
6 changes: 5 additions & 1 deletion src/githubApiClient.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { RestEndpointMethods } from '@octokit/plugin-rest-endpoint-methods/dist-types/generated/method-types';
import { getOctokit } from '@actions/github';
import { getInput } from '@actions/core';
// NOTE: Import below is child dependency of @actions/github which is only used for a type (which is not exported)
// eslint-disable-next-line import/no-unresolved
import type { RestEndpointMethods } from '@octokit/plugin-rest-endpoint-methods/dist-types/generated/method-types';

/**
* Get Github Rest Client
*
* @returns Github Rest client
*/
export default function getRestClient(): RestEndpointMethods {
const octokit = getOctokit(getInput('github-token'));
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -828,19 +828,19 @@
resolved "https://registry.yarnpkg.com/@octokit/webhooks-methods/-/webhooks-methods-2.0.0.tgz#1108b9ea661ca6c81e4a8bfa63a09eb27d5bc2db"
integrity sha512-35cfQ4YWlnZnmZKmIxlGPUPLtbkF8lr/A/1Sk1eC0ddLMwQN06dOuLc+dI3YLQS+T+MoNt3DIQ0NynwgKPilig==

"@octokit/webhooks-types@4.7.0":
version "4.7.0"
resolved "https://registry.yarnpkg.com/@octokit/webhooks-types/-/webhooks-types-4.7.0.tgz#0d86cb32a6502da41d2a33b243102f96012bddbb"
integrity sha512-LWTPedtJtcdA1+k+iERtCr7UnO/d+Cr00/vRPhjASTHz2G/ZtSAnDNjDv5c7X2R7OJsPE6eFUMT7frwjjuAbZA==
"@octokit/webhooks-types@4.17.1":
version "4.17.1"
resolved "https://registry.yarnpkg.com/@octokit/webhooks-types/-/webhooks-types-4.17.1.tgz#850a29131c9cb03c22ad76a3c9d5c55500ce9beb"
integrity sha512-L8VCfue+t5oopkPr81f2+LgWLAZbaX6gyu5fVYhWq8QE/QmzdyHuQr5zbUbCfAGAC0a1eRPPYmwPFPFOncku7A==

"@octokit/webhooks@^9.15.0":
version "9.15.0"
resolved "https://registry.yarnpkg.com/@octokit/webhooks/-/webhooks-9.15.0.tgz#ed43660c1911755747b5c1b2847081eb96d8e0a0"
integrity sha512-IFHXmTT4rVz8TbH5oH8qmJkM9UJLo75mmaMydKdn0j/ffLuTQ/+j6+Jl5dyboUo6AtUwaklFacszViVCKHME6A==
version "9.20.0"
resolved "https://registry.yarnpkg.com/@octokit/webhooks/-/webhooks-9.20.0.tgz#ff68774f7c0aad916959566801d42fb56c4bf116"
integrity sha512-NUFZKaQkGJl19FIfyaHdwjpR7XG0ekT3EFICjaz1vOFb/Dp/ebg9hn8bOwTusTsZjD0oPfPWxuHPKprBJ52swA==
dependencies:
"@octokit/request-error" "^2.0.2"
"@octokit/webhooks-methods" "^2.0.0"
"@octokit/webhooks-types" "4.7.0"
"@octokit/webhooks-types" "4.17.1"
aggregate-error "^3.1.0"

"@side/commitlint-config@^0.1.6":
Expand Down

0 comments on commit 303aa05

Please sign in to comment.