-
Notifications
You must be signed in to change notification settings - Fork 931
[doctor command] Add tests for androidSDK and androidNDK #742
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
[doctor command] Add tests for androidSDK and androidNDK #742
Conversation
|
@lucasbento tests are failing on Windows because apparently the I'm not too sure why but I'm suspecting the cli/packages/cli/src/commands/doctor/healthchecks/androidSDK.ts Lines 24 to 29 in ed0a6fd
|
|
I'd mock a response that we expect, no time for long timeouts. |
|
Yes, that's definitely a better approach 😄 |
lucasbento
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few comments, good work as always 🙂
packages/cli/src/commands/doctor/healthchecks/__tests__/androidNDK.test.ts
Outdated
Show resolved
Hide resolved
packages/cli/src/commands/doctor/healthchecks/__tests__/androidNDK.test.ts
Outdated
Show resolved
Hide resolved
packages/cli/src/commands/doctor/healthchecks/__tests__/androidSDK.test.ts
Outdated
Show resolved
Hide resolved
packages/cli/src/commands/doctor/healthchecks/__tests__/androidSDK.test.ts
Outdated
Show resolved
Hide resolved
packages/cli/src/commands/doctor/healthchecks/__tests__/androidSDK.test.ts
Outdated
Show resolved
Hide resolved
packages/cli/src/commands/doctor/healthchecks/__tests__/androidSDK.test.ts
Show resolved
Hide resolved
packages/cli/src/commands/doctor/healthchecks/__tests__/androidSDK.test.ts
Outdated
Show resolved
Hide resolved
|
@lucasbento thanks for the good review. Everything should be fixed. |
lucasbento
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks @thib92!
|
Btw I'm doing a lot of copy-paste between all the healthcheck tests. Once I'm done with all of them, I'll see if I can create util functions to avoid repeating code in the tests. |
|
@thymikee: can you please give a review? |
| const logSpy = jest.spyOn(common, 'logManualInstallation'); | ||
|
|
||
| const mockExeca = (stdout: string) => { | ||
| jest.mock('execa', () => jest.fn()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jest.mock is hosited to the top of the parent scope, it's not meant to be called mutliple times. Can you move it to the top-level scope, right after imports, so it's a bit more obvious the execa module is mocked?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it a little bit to be easier to understand and more standard. What do you think?
|
|
||
| const logSpy = jest.spyOn(common, 'logManualInstallation'); | ||
|
|
||
| const mockExeca = (stdout: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename it to mockSdkManagerResponse or something so that it's closer to what it's actually doing, since we don't extract execa call to a function we could mock – which would make it obvious what is mocked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See what I changed. What do you think?
thymikee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, small things to adjust
Summary:
Add unit tests for the healthchecks for
androidSDKandandroidNDKAlso removed a
$FlowFixMethat wasn't removed when theandroidSDKfile was moved to TS.Related to #694
Test Plan:
CI is green