refactor mylistings and my rentals

This commit is contained in:
jackiettran
2025-11-01 22:33:59 -04:00
parent 16272ba373
commit 6d0beccea0
14 changed files with 42 additions and 42 deletions

View File

@@ -66,7 +66,7 @@ describe('Rentals Routes', () => {
jest.clearAllMocks();
});
describe('GET /my-rentals', () => {
describe('GET /renting', () => {
it('should get rentals for authenticated user', async () => {
const mockRentals = [
{
@@ -86,7 +86,7 @@ describe('Rentals Routes', () => {
mockRentalFindAll.mockResolvedValue(mockRentals);
const response = await request(app)
.get('/rentals/my-rentals');
.get('/rentals/renting');
expect(response.status).toBe(200);
expect(response.body).toEqual(mockRentals);
@@ -108,14 +108,14 @@ describe('Rentals Routes', () => {
mockRentalFindAll.mockRejectedValue(new Error('Database error'));
const response = await request(app)
.get('/rentals/my-rentals');
.get('/rentals/renting');
expect(response.status).toBe(500);
expect(response.body).toEqual({ error: 'Failed to fetch rentals' });
});
});
describe('GET /my-listings', () => {
describe('GET /owning', () => {
it('should get listings for authenticated user', async () => {
const mockListings = [
{
@@ -129,7 +129,7 @@ describe('Rentals Routes', () => {
mockRentalFindAll.mockResolvedValue(mockListings);
const response = await request(app)
.get('/rentals/my-listings');
.get('/rentals/owning');
expect(response.status).toBe(200);
expect(response.body).toEqual(mockListings);
@@ -151,7 +151,7 @@ describe('Rentals Routes', () => {
mockRentalFindAll.mockRejectedValue(new Error('Database error'));
const response = await request(app)
.get('/rentals/my-listings');
.get('/rentals/owning');
expect(response.status).toBe(500);
expect(response.body).toEqual({ error: 'Failed to fetch listings' });