Skip to content

Unit tests#17

Merged
Ciscode-Admin merged 18 commits intomasterfrom
unit-tests
Feb 4, 2026
Merged

Unit tests#17
Ciscode-Admin merged 18 commits intomasterfrom
unit-tests

Conversation

@a-elkhiraooui-ciscode
Copy link
Contributor

@a-elkhiraooui-ciscode a-elkhiraooui-ciscode commented Feb 4, 2026

Summary

  • What does this PR change?

Why

  • Why is this change needed?

Checklist

  • Added/updated tests (if behavior changed)
  • npm run lint passes
  • npm run typecheck passes
  • npm test passes
  • npm run build passes
  • Added a changeset (npx changeset) if this affects consumers

Notes

  • Anything reviewers should pay attention to?

@a-elkhiraooui-ciscode a-elkhiraooui-ciscode requested review from a team and Copilot February 4, 2026 09:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces comprehensive unit testing infrastructure to the authentication kit module using Vitest and React Testing Library, along with minor updates to the ProfilePage component to split name handling into separate first name, last name, and username fields.

Changes:

  • Adds Vitest configuration with jsdom environment and centralized test setup
  • Implements unit tests for utilities (JWT helpers, color helpers, auth interceptor), hooks (useAbility), contexts (AuthState, AuthConfig, Rbac), and components (SessionExpiredModal, RequirePermissions, InputField, InlineError)
  • Adds comprehensive test infrastructure including required dependencies and npm scripts
  • Updates ProfilePage to handle structured name fields (fname, lname, username) instead of a single name field

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
vitest.config.ts Configures Vitest with jsdom environment and test file patterns
tests/setup.ts Sets up React Testing Library with jest-dom matchers and cleanup
tests/utils/jwtHelpers.test.ts Tests JWT token decoding with field mapping and defaults
tests/utils/colorHelpers.test.ts Tests Tailwind color class conversion utility
tests/utils/attachAuthInterceptor.test.ts Tests auth interceptor with token refresh and logout behavior
tests/providers/AuthProvider.test.tsx Tests AuthProvider routing and authentication state
tests/hooks/useAbility.test.tsx Tests role, module, and permission checking hooks
tests/context/RbacContext.test.tsx Tests RBAC grant logic with permissions and roles
tests/context/AuthStateContext.test.tsx Tests auth state context provider and consumer behavior
tests/context/AuthConfigContext.test.tsx Tests auth config context provider and consumer behavior
tests/components/SessionExpiredModal.test.tsx Tests modal rendering and body style management
tests/components/RequirePermissions.test.tsx Tests permission-based access control component
tests/components/InputField.test.tsx Tests input field rendering and change handling
tests/components/InlineError.test.tsx Tests error display with auto-dismiss and manual dismiss
src/components/ProfilePage.tsx Splits name into fname, lname, and username fields
package.json Adds test dependencies and scripts, bumps version to 1.0.12
README.md Documents testing approach and commands

@Ciscode-Admin Ciscode-Admin merged commit 1be41bc into master Feb 4, 2026
1 check passed
@Ciscode-Admin Ciscode-Admin deleted the unit-tests branch February 4, 2026 09:17
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.

2 participants