Skip to content

test: User signup with an existing email #7

Closed

Description

@archa8

Purpose of the Test

This test is needed to cover a critical security and data integrity edge case for the user registration process. It ensures that the system prevents duplicate user accounts from being created with the same email address.

Related Feature/Functionality

  • Module: Authentication
  • Endpoint: POST /api/auth/signup
  • Controller: signup function in authController.js

Proposed Test Cases

  1. It should reject a signup attempt with an email address that is already in use.

Current Gaps

The current test suite for authentication (auth.test.js) only validates the "happy path" or successful user signup. It does not contain any tests for failure scenarios, such as when a user tries to register with an email that already exists.

Expected Outcome

The test should confirm that when a POST request is sent to /api/auth/signup with an existing email, the API correctly returns a 400 Bad Request status code. It should also verify that no new user is created in the database.

Additional Notes

  • This test should be added to the backend/__tests__/auth.test.js file.
  • The test will need to first create a user in the in-memory database during its setup phase before attempting to register the same user again.

Activity

  1. added
    hacktoberfestIssues marked with this label are part of Hacktoberfest and open for contributions
    testRequest or propose new test cases
    on Sep 27, 2025
  2. Pawankalyan2023 commented on Sep 27, 2025

    @Pawankalyan2023
    Contributor

    Hi @archa8 would like to work on this issue , please assign this to me

  3. RahulHarihar commented on Sep 27, 2025

    @RahulHarihar
    Contributor

    Hey @archa8 , I’ve submitted a PR that addresses the issue you opened regarding duplicate email signup and missing field validation.

    Could you please take a look and let me know if it meets the requirements?

    Here’s the PR link: #16

    Thanks!

  4. removed
    hacktoberfestIssues marked with this label are part of Hacktoberfest and open for contributions
    on Sep 29, 2025
  5. archa8 commented on Sep 29, 2025

    @archa8
    MemberAuthor

    Hey @RahulHarihar please open a new PR according to the comment I've put on PR #16

  6. RahulHarihar commented on Sep 29, 2025

    @RahulHarihar
    Contributor

    Hi @archa8, Thanks for the note! I’ll go through your comments and open a new PR based on them.

  7. RahulHarihar commented on Oct 1, 2025

    @RahulHarihar
    Contributor

    Hi @archa8, I have opened a new PR based on your comments.

    Here's the PR link #46

    Also, can you please add 'hacktoberfest' as a label to this issue? That would be helpful.
    Thanks!

  8. added
    hacktoberfestIssues marked with this label are part of Hacktoberfest and open for contributions
    on Oct 2, 2025
  9. linked a pull request that will close this issueTest/auth signup validation cleanup #46on Oct 3, 2025
  10. moved this from up-for-grabs to done in OS - TASK TRACKERon Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

good first issueGood for newcomershacktoberfestIssues marked with this label are part of Hacktoberfest and open for contributionstestRequest or propose new test cases

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions