[TS migration] Migrate GithubUtilsTest to typescript#36427
[TS migration] Migrate GithubUtilsTest to typescript#36427yuwenmemon merged 8 commits intoExpensify:mainfrom
Conversation
fabioh8010
left a comment
There was a problem hiding this comment.
Please check @octokit/* and @actions/* libraries that we use to see if we can reuse any types declared here.
| PRList: Array<{ | ||
| url: string; | ||
| number: number; | ||
| isVerified: boolean; | ||
| }>; |
There was a problem hiding this comment.
Could you extract this object into a separate type and use it here?
| 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; | ||
| }>; |
| 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; | ||
| }>; |
|
|
||
| type Mutable<T> = {-readonly [P in keyof T]: T[P]}; | ||
|
|
||
| const asMutable = <T>(value: T): Mutable<T> => value as Mutable<T>; |
| asMutable(core).getInput = mockGetInput; | ||
|
|
||
| // Mock octokit module | ||
| const moctokit = { |
There was a problem hiding this comment.
Is possible to use a type from GitHub library here?
There was a problem hiding this comment.
I couldn't find a way to make the mock complaint with the GitHub lib typing.
There was too a lot of missing fields which we do not use on the unit test that needed to be populated and couldn't find a solution for all of them, the best way I think is to have GithubUtils correctly typed so this one would automatically get the correct types.
| isResolved: boolean; | ||
| }; | ||
|
|
||
| type PR = { |
There was a problem hiding this comment.
| type PR = { | |
| type PullRequest = { |
| data: T; | ||
| }; | ||
|
|
||
| type Mutable<T> = {-readonly [P in keyof T]: T[P]}; |
There was a problem hiding this comment.
Maybe you can reuse Writable type form type-fest lib
| { | ||
| number: 3, | ||
| title: 'Test PR 3', | ||
| // eslint-disable-next-line @typescript-eslint/naming-convention |
There was a problem hiding this comment.
How about disabling it in whole file?
There was a problem hiding this comment.
Based on this conv, it seems that c+ does not need to review the migration of test files, so approve it. :)
cc @yuwenmemon
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #25283 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
🚀 Deployed to staging by https://github.com/yuwenmemon in version: 1.4.44-0 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.44-13 🚀
|
Details
[TS migration] Migrate *GithubUtilsTest to TypeScript
Fixed Issues
$ #25283
PROPOSAL: N/A
Tests
Verify that no errors appear in the JS console
Run GithubUtilsTest unit test works as before
Offline tests
N/A
QA Steps
Same as in the Tests section.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
N/a
Android: mWeb Chrome
N/a
iOS: Native
N/a
iOS: mWeb Safari
N/a
MacOS: Chrome / Safari
N/a
MacOS: Desktop
N/a