[Test]: Add unit tests for `validatePassword` in `backend/src/utils/validations.ts`
Author: karthik120710Created Sep 11, 2026Updated Sep 11, 2026
Labelsenhancementneeds-triage
What feature do you want?
Description:
validatePassword (backend/src/utils/validations.ts:14) is used by auth.service.ts to validate
passwords on signup, but it currently has no test coverage. It has 5 independent branches
(minimum length, requireNumber, requireLowercase, requireUppercase, requireSpecialChar)
that should each be exercised.
Every sibling function in the same file (validateEmail, escapeSqlLikePattern, etc.) already has
tests in backend/tests/unit/validations.test.ts — validatePassword is the one gap.
Why do you need this?
Add these unit test to make validate Suggested approach:
- Add a
describe('validatePassword', ...)block tobackend/tests/unit/validations.test.ts. - Cover: passing password, too-short password, and one failing case per rule flag
(
requireNumber,requireLowercase,requireUppercase,requireSpecialChar), plus a case with multiple flags combined.
Source: InsForge/InsForge