-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
test: MM-59420 unit test for app/actions/remote/integrations.ts #8305
base: main
Are you sure you want to change the base?
Conversation
Hello @Prathamesh010, Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here. Per the Mattermost Contribution Guide, we need to add you to the list of approved contributors for the Mattermost project. Please help complete the Mattermost contribution license agreement? This is a standard procedure for many open source projects. Please let us know if you have any questions. We are very happy to have you join our growing community! If you're not yet a member, please consider joining our Contributors community channel to meet other contributors and discuss new opportunities with the core team. |
/check-cla |
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
beforeAll(() => { | ||
// eslint-disable-next-line | ||
// @ts-ignore | ||
NetworkManager.getClient = () => mockClient; | ||
}); |
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.
I know part of the codebase do it this way, but I feel it is a better test if we follow what is done in app/managers/draft_upload_manager
with something like this:
const mockClient = TestHelper.createClient();
jest.mock('@managers/network_manager', () => {
const original = jest.requireActual('@managers/network_manager');
return {
...original,
getClient: (serverUrl: string) => {
if (serverUrl === url) {
return mockClient;
}
throw new Error('client not found');
},
};
});
Among other things, this helps verify that we are getting the correct client. Not a huge deal, because there would be little chance we are doing that wrong, but makes the test more correct with not much more effort (and less ts-ignore comments :P).
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
Summary
Fixes: #2766
Ticket Link
Checklist
E2E iOS tests for PR
.Screenshots
Release Note