fix unit tests
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 12m54s

This commit is contained in:
2025-12-30 03:19:23 -08:00
parent 62592f707e
commit cadacb63f5
11 changed files with 104 additions and 19 deletions

View File

@@ -21,7 +21,7 @@ describe('User API Routes Integration Tests', () => {
// The token will be used for all subsequent API calls in this test suite.
beforeAll(async () => {
const email = `user-test-${Date.now()}@example.com`;
const { user, token } = await createAndLoginUser({ email, fullName: 'Test User' });
const { user, token } = await createAndLoginUser({ email, fullName: 'Test User', request });
testUser = user;
authToken = token;
});
@@ -130,7 +130,7 @@ describe('User API Routes Integration Tests', () => {
it('should allow a user to delete their own account and then fail to log in', async () => {
// Arrange: Create a new, separate user just for this deletion test.
const deletionEmail = `delete-me-${Date.now()}@example.com`;
const { token: deletionToken } = await createAndLoginUser({ email: deletionEmail });
const { token: deletionToken } = await createAndLoginUser({ email: deletionEmail, request });
// Act: Call the delete endpoint with the correct password and token.
const response = await request
@@ -155,7 +155,7 @@ describe('User API Routes Integration Tests', () => {
it('should allow a user to reset their password and log in with the new one', async () => {
// Arrange: Create a new user for the password reset flow.
const resetEmail = `reset-me-${Date.now()}@example.com`;
const { user: resetUser } = await createAndLoginUser({ email: resetEmail });
const { user: resetUser } = await createAndLoginUser({ email: resetEmail, request });
// Act 1: Request a password reset. In our test environment, the token is returned in the response.
const resetRequestRawResponse = await request