Skip to content

test : added vitest unit tests for server/utils AppError class hierarchy#1500

Open
tmdeveloper007 wants to merge 1 commit into
gopaljilab:mainfrom
tmdeveloper007:#1495
Open

test : added vitest unit tests for server/utils AppError class hierarchy#1500
tmdeveloper007 wants to merge 1 commit into
gopaljilab:mainfrom
tmdeveloper007:#1495

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Closes #1495.

Summary of What Has Been Done:
Added 34 vitest tests for the AppError class hierarchy in server/utils/AppError.ts. Covers the base AppError class and all 5 subclasses (ValidationError, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError) with their HTTP status codes, default messages, isOperational defaults, and errorCode propagation.

Changes Made:

  • server/utils/AppError.test.ts (204 lines, 34 tests across 7 describe blocks)

Impact it Made:

  • Validates HTTP status code contracts for all 5 subclasses used throughout the server
  • Guards against regressions when error classes are refactored
  • Ensures error codes propagate correctly for monitoring and logging

Note: Please assign this PR to the tmdeveloper007 account.

- 34 tests covering AppError base class and all 5 subclasses
  (ValidationError 400, UnauthorizedError 401, ForbiddenError 403,
   NotFoundError 404, ConflictError 409)
- Tests statusCode contracts, isOperational defaults, errorCode propagation
- Tests instanceof relationships and stack trace presence
@vercel

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown

@tmdeveloper007 is attempting to deploy a commit to the gopaljilab's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the type:testing Adding, updating, or fixing unit/integration tests. label Jun 19, 2026
@tmdeveloper007

Copy link
Copy Markdown
Contributor Author

Workflow run awaiting maintainer approval — please approve from the Actions tab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:testing Adding, updating, or fixing unit/integration tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test : add unit tests for server/utils AppError class hierarchy

1 participant