[YW-359] Testing admin services and utils#17
Merged
sherryy021229-sys merged 3 commits intomainfrom Oct 22, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive test coverage for admin services, utilities, and components. It introduces over 40 new test files covering status utilities, permissions, formatters, export utilities, constants, and multiple admin services (user, settings, review, report, ranking, novel, mock API, library, auth, analytics, dashboard, comment, chapter, and category services), as well as table components and modals.
Key Changes
- Added extensive test coverage for admin utility functions (status, permissions, formatters, export, constants)
- Implemented comprehensive service layer tests with axios mocking and interceptor testing
- Added component tests for tables (DataTable, TableFilters, ExportButton, ColumnSelector, BulkActions) and modals (ViewModal, SuspendUserModal)
- Updated package.json to move
@testing-library/user-eventto devDependencies and upgrade to v14.6.1, addedbabel-jestv30.2.0
Reviewed Changes
Copilot reviewed 40 out of 43 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/admin/statusutils.test.js | Tests for status utility functions including config retrieval, badge/tag props, transitions, statistics, filtering, sorting, and formatting |
| src/utils/admin/permissions.test.js | Tests for permission checking, role hierarchy, action authorization, and menu filtering |
| src/utils/admin/formatters.test.js | Tests for various formatting utilities (currency, percentage, dates, relative time, duration, phone, etc.) |
| src/utils/admin/exportutils.test.js | Tests for CSV/Excel/JSON export functionality and validation |
| src/utils/admin/constants.test.js | Tests for constant definitions and configuration values |
| src/services/admin/*.test.js | Comprehensive service layer tests with axios mocking and interceptor testing |
| src/components/admin/tables/*.test.jsx | Component tests for table-related components |
| src/components/admin/modals/*.test.jsx | Component tests for modal components |
| package.json | Dependency updates for testing libraries |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
LuxuryB
approved these changes
Oct 22, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Testing admin services and utils