-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[No QA] Clean up jest mocks #12097
[No QA] Clean up jest mocks #12097
Conversation
// The main app uses a NativeModule called BootSplash to show/hide a splash screen. Since we can't use this in the node environment | ||
// where tests run we simulate a behavior where the splash screen is always hidden (similar to web which has no splash screen at all). | ||
jest.mock('../src/libs/BootSplash', () => ({ | ||
hide: jest.fn(), | ||
getVisibilityStatus: jest.fn().mockResolvedValue('hidden'), | ||
})); |
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.
Do we no longer need it?
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.
tests seem to pass without it so guessing whatever we needed it for we don't need it anymore.
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.
Cool then!
// Set up manual mocks for methods used in the actions so our test does not fail. | ||
jest.mock('../../src/libs/Notification/PushNotification', () => ({ | ||
// There is no need for a jest.fn() since we don't need to make assertions against it. | ||
register: () => {}, | ||
deregister: () => {}, | ||
})); | ||
|
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.
Don't we need this anymore?
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.
same as the other comment
Resolve conflicts |
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.
Looks good. 🎉
Thanks, quick question @marcaaron shouldn't we capture this practice in markdown/docs? |
Screenshots are not applicable here.
C+ Reviewed 🎀 👀 🎀 |
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.
Looks good, just have a question here #12097 (comment)
Yeah I think that's a good idea. Let me add something. |
53b16c1
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.
Looks good, thanks!
@techievivek looks like this was merged without the checklist test passing. Please add a note explaining why this was done and remove the |
Not an emergency, tests were passing. |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by @techievivek in version: 1.2.20-0 🚀
|
🚀 Deployed to production by @chiragsalian in version: 1.2.20-3 🚀
|
Details
Some cleanup for the jest tests and moves some individual mocks in the global
jest/setup.js
file to individual user mocks files. We should adopt this practice moving forward. No app code was touched besides tests here so I don't think we need to test on all platforms.Fixed Issues
$ https://github.com/Expensify/Expensify/issues/228440
Tests
N/A
QA Steps
N/A
PR Review Checklist
PR Author Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)PR Reviewer Checklist
The reviewer will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
have been tested & I retested again)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Screenshots
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android