removed cron job that made rentals active. Now whether or not the rental is active is determined on the fly
This commit is contained in:
@@ -790,11 +790,15 @@ describe('Rentals Routes', () => {
|
||||
});
|
||||
|
||||
describe('POST /:id/mark-completed', () => {
|
||||
// Active status is computed: confirmed + startDateTime in the past
|
||||
const pastDate = new Date();
|
||||
pastDate.setHours(pastDate.getHours() - 1); // 1 hour ago
|
||||
const mockRental = {
|
||||
id: 1,
|
||||
ownerId: 1,
|
||||
renterId: 2,
|
||||
status: 'active',
|
||||
status: 'confirmed',
|
||||
startDateTime: pastDate,
|
||||
update: jest.fn(),
|
||||
};
|
||||
|
||||
@@ -837,7 +841,7 @@ describe('Rentals Routes', () => {
|
||||
|
||||
expect(response.status).toBe(400);
|
||||
expect(response.body).toEqual({
|
||||
error: 'Can only mark active or confirmed rentals as completed',
|
||||
error: 'Can only mark active rentals as completed',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user