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

2 tests #562

Open
2 tasks done
el-riber opened this issue Nov 21, 2024 · 0 comments · May be fixed by #563
Open
2 tasks done

2 tests #562

el-riber opened this issue Nov 21, 2024 · 0 comments · May be fixed by #563
Assignees

Comments

@el-riber
Copy link
Contributor

el-riber commented Nov 21, 2024

1 Subject: Test Implementation for FormPage Component

  • Test Goals for FormPage:

The goal of these tests was to verify the functionality and behavior of the FormPage component, ensuring a smooth and reliable user experience. The following objectives were targeted:

Rendering Validation:

Confirm that all essential elements of the form (e.g., input fields for Name, Gender, Email, Size, and the Submit button) render correctly and are visible to the user.
User Interaction Testing:

Simulate user input into all form fields to ensure that data is captured correctly.
Validate that the form submission works as expected by checking if the submitted data is logged correctly in the console (mocked for the test).
These tests help ensure that the FormPage works as intended and provides a solid foundation for further development or enhancements.

Let me know if you need further details or improvements!

test:
npm test form-page.test.tsx

  • Subject: Test Goals for EditUserRolePage Component

Objective: The purpose of the tests for the EditUserRolePage component is to ensure its core functionality works as intended and that different user roles are handled correctly. This includes testing the behavior of the page for admin users and non-admin users, as well as verifying the data flow and error handling.

Test Goals:

Admin User Access:

Verify that admin users can access the EditUserRolePage.
Ensure the UserCard components are correctly displayed with user data fetched from the API.
Non-Admin User Restriction:

Ensure that non-admin users see an UnauthorizedPageMessage and cannot access the admin functionality.
Data Fetching:

Mock the API response to confirm that the user data is fetched and displayed correctly.
Test how the component handles errors or missing tokens during the data-fetching process.
Error Handling:

Ensure the page gracefully handles missing or invalid tokens by rendering the appropriate error message.
Component Integration:

Verify the integration of child components like UserCard and UnauthorizedPageMessage using mocks.

npm test edit-user-role-page.test.tsx
Screenshot (35)
Screenshot (39)

@el-riber el-riber linked a pull request Nov 21, 2024 that will close this issue
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 a pull request may close this issue.

1 participant