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

refactor : using msw instead of jest.mock of useUserData hook in tests. #764

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

Shah-Arsalan
Copy link
Contributor

@Shah-Arsalan Shah-Arsalan commented Jul 23, 2023

Issue: Employ msw instead of jest.mock of useUserData hook in tests.

Description: In certain test files userUserData hook was being mocked to get some test value. The task is to employ msw in place of jest.mock.

Dev Tested:

  • Yes

Images/video of the change:

test-card

tests-taskdetails

test-tasklevel

3 files needed change in total wrt to employing msw

@vercel
Copy link

vercel bot commented Jul 23, 2023

@Shah-Arsalan is attempting to deploy a commit to the RDS-Team Team on Vercel.

A member of the Team first needs to authorize it.

@@ -124,7 +122,8 @@ describe('Task card', () => {
expect(queryByTestId('task-card')).toBeInTheDocument();
});

test('should show edit button when ALT key is long pressed', () => {
test('should show edit button when ALT key is long pressed', async () => {
server.use(...adminUserHandler);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we using aminUserHandler here when we are not doing any testing related to it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Beacuse the code is written as {isUserAuthorized && showEditButton && <EditButton />} . So to get the isUserAuthorized values as true we need to use adminUserHandler. The long press of ALT key is just turning the boolean showEditButton from false to true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants