Skip to content

test: add comprehensive Employee Profile component tests#1540

Open
serikjensen wants to merge 1 commit intomainfrom
sdk-776-employee-profile-tests
Open

test: add comprehensive Employee Profile component tests#1540
serikjensen wants to merge 1 commit intomainfrom
sdk-776-employee-profile-tests

Conversation

@serikjensen
Copy link
Copy Markdown
Member

Summary

  • Adds 45 unit tests for the Employee.Profile component to guard against regressions during the upcoming hooks migration (useEmployeeDetails, useWorkAddress, etc.)
  • Covers field presence/conditional rendering, self-onboarding toggle behavior, onboarding status conditionals, required field enforcement, SSN enable/disable coordination, form submission payloads (create + update), onboarding status updates, home address skip logic, work address admin gating, courtesyWithholding pass-through, startDate in done event, default values/precedence, and edge cases
  • Mutation testing verified 7/8 targeted regressions are caught; the one miss has triple-layer redundant defense (rendering gate + schema exclusion + property check)

Test plan

  • All 45 tests pass (npm run test -- --run src/components/Employee/Profile/Profile.test.tsx)
  • Zero lint/TS errors
  • Mutation testing validated test effectiveness against 8 targeted regressions
  • No source code changes — test file only

Made with Cursor

Add 45 unit tests covering the Employee Profile component to guard
against regressions during the upcoming hooks migration. Coverage
includes:

- Field presence and conditional rendering (admin vs self-onboarding)
- Self-onboarding toggle behavior (show/hide SSN, DOB, home address)
- Onboarding status conditionals for all status values
- Required field enforcement for admin and self paths
- SSN enable/disable behavior and enableSsn coordination
- Form submission payloads for create and update flows
- Onboarding status update during submission (both directions)
- Home address skip logic based on self-onboarding state
- Work address gating for non-admin users
- courtesyWithholding pass-through in home address payloads
- startDate inclusion in EMPLOYEE_PROFILE_DONE event
- Default values and precedence with existing employee data
- Edge cases (empty form, multiple addresses, SSN placeholder)

Made-with: Cursor
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.

1 participant