updated tests

This commit is contained in:
jackiettran
2026-01-15 18:47:43 -05:00
parent 35d5050286
commit 63385e049c
13 changed files with 256 additions and 201 deletions

View File

@@ -226,7 +226,7 @@ describe('Auth Integration Tests', () => {
})
.expect(401);
expect(response.body.error).toBe('Unable to log in. Please check your email and password, or create an account.');
expect(response.body.error).toBe('Please check your email and password, or create an account.');
});
it('should reject login with non-existent email', async () => {
@@ -238,7 +238,7 @@ describe('Auth Integration Tests', () => {
})
.expect(401);
expect(response.body.error).toBe('Unable to log in. Please check your email and password, or create an account.');
expect(response.body.error).toBe('Please check your email and password, or create an account.');
});
it('should increment login attempts on failed login', async () => {
@@ -255,8 +255,8 @@ describe('Auth Integration Tests', () => {
});
it('should lock account after too many failed attempts', async () => {
// Make 5 failed login attempts
for (let i = 0; i < 5; i++) {
// Make 10 failed login attempts (MAX_LOGIN_ATTEMPTS is 10)
for (let i = 0; i < 10; i++) {
await request(app)
.post('/auth/login')
.send({
@@ -265,7 +265,7 @@ describe('Auth Integration Tests', () => {
});
}
// 6th attempt should return locked error
// 11th attempt should return locked error
const response = await request(app)
.post('/auth/login')
.send({

View File

@@ -411,20 +411,20 @@ describe('Rental Integration Tests', () => {
expect(response.body.status).toBe('confirmed');
// Step 2: Rental becomes active (typically done by system/webhook)
await rental.update({ status: 'active' });
// Verify status
// Step 2: Rental is now "active" because status is confirmed and startDateTime has passed
// Note: "active" is a computed status, not stored. The stored status remains "confirmed"
await rental.reload();
expect(rental.status).toBe('active');
expect(rental.status).toBe('confirmed'); // Stored status is still 'confirmed'
// isActive() returns true because status='confirmed' and startDateTime is in the past
// Step 3: Owner marks rental as completed
// Step 3: Owner marks rental as completed (via mark-return with status='returned')
response = await request(app)
.post(`/rentals/${rental.id}/mark-completed`)
.post(`/rentals/${rental.id}/mark-return`)
.set('Cookie', [`accessToken=${ownerToken}`])
.send({ status: 'returned' })
.expect(200);
expect(response.body.status).toBe('completed');
expect(response.body.rental.status).toBe('completed');
// Verify final state
await rental.reload();