Skip to content

test : added unit tests for server.utils.AppError class hierarchy#1471

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

test : added unit tests for server.utils.AppError class hierarchy#1471
tmdeveloper007 wants to merge 1 commit into
gopaljilab:mainfrom
tmdeveloper007:#1466

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Closes #1466.

Summary of What Has Been Done:
Added vitest tests for AppError and all subclasses (ValidationError, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError) in server/utils/AppError.ts. Tests verify correct HTTP status codes, isOperational defaults, errorCode fields, instanceof checks, and stack trace capture. All 32 tests pass.

Changes Made:

  • server/utils/AppError.test.ts (new file, 183 lines) — 32 test cases

Impact it Made:

  • Ensures typed error classes reliably emit the correct HTTP status codes for Express error middleware
  • Guards against silent regressions when modifying the error class hierarchy
  • All tests green: npx vitest run server/utils/AppError.test.ts (32 passed)

Note: Please assign this PR to the tmdeveloper007 account.

@vercel

vercel Bot commented Jun 18, 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 18, 2026
@tmdeveloper007

Copy link
Copy Markdown
Contributor Author

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

1 similar comment
@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