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

[TS migration] Migrate GithubUtilsTest to typescript #36427

Merged
merged 8 commits into from
Feb 26, 2024
48 changes: 22 additions & 26 deletions tests/unit/GithubUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,28 @@
isResolved: boolean;
};

type PR = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
type PR = {
type PullRequest = {

url: string;
number: number;
isVerified: boolean;
};

type Label = {
id: number;
number?: number;
isVerified?: boolean;
// eslint-disable-next-line @typescript-eslint/naming-convention
node_id: string;
url: string;
name: string;
color: string;
default: boolean;
description: string;
};

type ExpectedReponse = {
PRList: Array<{
url: string;
number: number;
isVerified: boolean;
}>;
labels: Array<{
color: string;
default: boolean;
description: string;
id: number;
name: string;
// eslint-disable-next-line @typescript-eslint/naming-convention
node_id: string;
url: string;
}>;
PRList: PR[];
labels: Label[];
tag: string;
title: string;
url: string;
Expand All @@ -43,16 +49,7 @@
type Issue = {
url: string;
title: string;
labels: Array<{
id: number;
// eslint-disable-next-line @typescript-eslint/naming-convention
node_id: string;
url: string;
name: string;
color: string;
default: boolean;
description: string;
}>;
labels: Label[];
body: string;
};

Expand Down Expand Up @@ -87,8 +84,7 @@
paginate: jest.fn().mockImplementation(<T>(objectMethod: () => Promise<ObjectMethodData<T>>) => objectMethod().then(({data}) => data)),
};

// @ts-expect-error TODO: Remove this once GithubUtils (https://github.com/Expensify/App/issues/25382) is migrated to TypeScript.
GithubUtils.internalOctokit = moctokit;

Check failure on line 87 in tests/unit/GithubUtilsTest.ts

View workflow job for this annotation

GitHub Actions / typecheck

Type '{ rest: { issues: { create: jest.Mock<any, any, any>; listForRepo: jest.Mock<any, any, any>; }; }; paginate: jest.Mock<any, any, any>; }' is not assignable to type 'Octokit & Api & { paginate: PaginateInterface; } & { paginate: PaginateInterface; }'.
});

afterEach(() => {
Expand Down
Loading