You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To prevent duplicate user accounts and ensure robust input validation during registration. These tests improve security, data integrity, and alignment between backend behaviour and test expectations.
Types of Changes
Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)
Enhancement (improvement to an existing feature)
Test (adds or updates tests only)
Documentation (non-code change)
How Has This Been Tested?
Ran all authentication tests (auth.test.js) locally.
Verified that:
Duplicate email returns "User already exists".
Missing email/password returns "Please enter all fields".
Hi @RahulHarihar ,
Thanks for your work on this.
I've looked at the pull request, and the changes you made in __tests__/auth.test.js, config/db.js and middleware/validationMiddleware.js look great! However, I'm seeing things like tab spaces being adjusted and single quotes in imports being changed to double quotes in many files, including the three mentioned before. This adds a lot of noise to the PR which makes it difficult review the actual test.
Could you please submit a new pull request that contains only the essential code changes?
Hey @archa8,
Thanks for taking the time to review my PR! I see what you mean about the formatting changes creating extra noise. I’ll clean it up and submit a new PR with just the essential code changes.
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
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.
Description
Added tests to handle edge cases in user signup. Specifically:
validateRegistrationmiddleware to check for empty fields first.All signup validation tests now pass, while production email, domain, and password validations remain intact.
Related Issue
Fixes #7
Motivation and Context
To prevent duplicate user accounts and ensure robust input validation during registration. These tests improve security, data integrity, and alignment between backend behaviour and test expectations.
Types of Changes
How Has This Been Tested?
auth.test.js) locally."User already exists"."Please enter all fields".Screenshots (if applicable):
N/A
Checklist