Frontend Unit Tests
For All React Component Tests
Not every React component from the class diagram will have their tests described in this document to avoid repetition.
Each React component will have its own test file with at a least one test case.
Every test file will check that the React component has rendered.
Every React component that updates state variables will have tests to verify that they are being updated correctly.
For example:
Test component was correctly rendered.
Test states being updated.
Mock Objects / Calls
- Mock versions of the user's personal information, inventory, tasks, and pet details will be used for the tests.
- Mock calls will be used to simulate interactions with the backend.
React Component Unit Tests
App
Details
DropDownMenu
Details
DropDownItem
Details
Test user clicking on DropDownItem component - Account Settings option.
Test user clicking on DropDownItem component - Canvas Integration option.
Test user clicking on DropDownItem component - Log Out option.
CanvasIntegrationPage
Details
AccountSettingsPage
Details
Test user updating email information.
Test user updating username.
Test user updating password
Input / User action
- User enters current and new password into input fields and clicks submit.
Expected Result
- On success, calls changePassword() which interacts with the backend to update password securely.
- On failure, user can be notified that:
- Current password was entered incorrectly.
- New passwords don't match.
- New password does not meet length/character requirements.
Test user deleting their account
Main
Details
PetSprite
Details
Test user feeding pet
Test user clicking on pet.
PageDisplay
Details
NavButton
Details
Test user clicking on NavButton component - Task Page button.
Test user clicking on NavButton component - Inventory Page button.
Test user clicking on NavButton component - Calendar Page button.
Test user clicking on NavButton component - Progress Page button.
TaskItem
Details
Test user updating task completion status.
Test user deleting task.
Test user selecting TaskItem component.
TaskDetails
Details
Test user editing task details.
Test user deleting task