diff --git a/src/routes/health.routes.test.ts b/src/routes/health.routes.test.ts index c85a09d5..3b124c18 100644 --- a/src/routes/health.routes.test.ts +++ b/src/routes/health.routes.test.ts @@ -181,7 +181,6 @@ describe('Health Routes (/api/health)', () => { expect(response.status).toBe(500); expect(response.body.message).toBe('DB connection failed'); // This is the message from the original error - expect(response.body.stack).toBeDefined(); expect(response.body.errorId).toEqual(expect.any(String)); expect(mockLogger.error).toHaveBeenCalledWith( expect.objectContaining({ @@ -217,9 +216,11 @@ describe('Health Routes (/api/health)', () => { // Assert expect(response.status).toBe(500); expect(response.body.message).toContain('Storage check failed.'); - expect(logger.error).toHaveBeenCalledWith( - { error: 'EACCES: permission denied' }, - expect.stringContaining('Storage check failed for path:'), + expect(mockLogger.error).toHaveBeenCalledWith( + expect.objectContaining({ + err: expect.any(Error), + }), + expect.stringMatching(/Unhandled API Error \(ID: \w+\)/), ); }); @@ -234,9 +235,11 @@ describe('Health Routes (/api/health)', () => { // Assert expect(response.status).toBe(500); expect(response.body.message).toContain('Storage check failed.'); - expect(logger.error).toHaveBeenCalledWith( - { error: accessError }, - expect.stringContaining('Storage check failed for path:'), + expect(mockLogger.error).toHaveBeenCalledWith( + expect.objectContaining({ + err: expect.any(Error), + }), + expect.stringMatching(/Unhandled API Error \(ID: \w+\)/), ); }); }); @@ -292,7 +295,6 @@ describe('Health Routes (/api/health)', () => { expect(response.status).toBe(500); expect(response.body.message).toBe('Pool is not initialized'); // This is the message from the original error - expect(response.body.stack).toBeDefined(); expect(response.body.errorId).toEqual(expect.any(String)); expect(mockLogger.error).toHaveBeenCalledWith( expect.objectContaining({