Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NoQA] [TS migration] Migrate checkDeployBlockersTest to Typescript #37035

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/types/utils/AsMutable.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, but could we rename it to asMutable.ts?

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type {Writable} from 'type-fest';

const asMutable = <T>(value: T): Writable<T> => value as Writable<T>;

export default asMutable;
12 changes: 5 additions & 7 deletions tests/unit/checkDeployBlockersTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* @jest-environment node
*/
import * as core from '@actions/core';
import type {Writable} from 'type-fest';
import asMutable from '@src/types/utils/AsMutable';
import run from '../../.github/actions/javascript/checkDeployBlockers/checkDeployBlockers';
import GithubUtils from '../../.github/libs/GithubUtils';

type Comment = {body: string};
type Comments = {
data?: Comment[];
type CommentData = {body: string};
type Comment = {
data?: CommentData[];
};

type PullRequest = {url: string; isQASuccess: boolean};
Expand All @@ -28,8 +28,6 @@ const mockSetOutput = jest.fn();
const mockGetIssue = jest.fn();
const mockListComments = jest.fn();

const asMutable = <T>(value: T): Writable<T> => value as Writable<T>;

beforeAll(() => {
// Mock core module
asMutable(core).getInput = mockGetInput;
Expand All @@ -49,7 +47,7 @@ beforeAll(() => {
GithubUtils.internalOctokit = moctokit;
});

let baseComments: Comments = {};
let baseComments: Comment = {};
beforeEach(() => {
baseComments = {
data: [
Expand Down
Loading