cd backend npm install -D vitest supertest
Please add this test script to your package.json:
Context: Test the security boundary of the backend/src/routes/auth-routes.ts.
Primary Task: Create backend/tests/auth.api.test.ts.
Specific Test Cases:
Registration: Send a POST to /auth/register. Expect 201 and verify the password is not returned in the JSON response.
Login Flow: Test valid login (200 OK) and invalid login (401 Unauthorized).
Security: Verify that the JWT or Session cookie is actually sent in the Set-Cookie header.
Constraint: Use a test database (like mongodb-memory-server) so you don't delete our real users.
cd backend npm install -D vitest supertestPlease add this test script to your package.json:
Context: Test the security boundary of the backend/src/routes/auth-routes.ts.
Primary Task: Create backend/tests/auth.api.test.ts.
Specific Test Cases:
Registration: Send a POST to /auth/register. Expect 201 and verify the password is not returned in the JSON response.
Login Flow: Test valid login (200 OK) and invalid login (401 Unauthorized).
Security: Verify that the JWT or Session cookie is actually sent in the Set-Cookie header.
Constraint: Use a test database (like mongodb-memory-server) so you don't delete our real users.