mirror of
https://github.com/immich-app/immich.git
synced 2025-12-29 22:21:28 -08:00
feat(server): better api error messages (for unhandled exceptions) (#4817)
* feat(server): better error messages * chore: open api * chore: remove debug log * fix: syntax error * fix: e2e test
This commit is contained in:
@@ -103,9 +103,9 @@ describe(`${ServerInfoController.name} (e2e)`, () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('GET /server-info/stats', () => {
|
||||
describe('GET /server-info/statistics', () => {
|
||||
it('should require authentication', async () => {
|
||||
const { status, body } = await request(server).get('/server-info/stats');
|
||||
const { status, body } = await request(server).get('/server-info/statistics');
|
||||
expect(status).toBe(401);
|
||||
expect(body).toEqual(errorStub.unauthorized);
|
||||
});
|
||||
@@ -115,7 +115,7 @@ describe(`${ServerInfoController.name} (e2e)`, () => {
|
||||
await api.userApi.create(server, accessToken, { ...loginDto, firstName: 'test', lastName: 'test' });
|
||||
const { accessToken: userAccessToken } = await api.authApi.login(server, loginDto);
|
||||
const { status, body } = await request(server)
|
||||
.get('/server-info/stats')
|
||||
.get('/server-info/statistics')
|
||||
.set('Authorization', `Bearer ${userAccessToken}`);
|
||||
expect(status).toBe(403);
|
||||
expect(body).toEqual(errorStub.forbidden);
|
||||
@@ -123,7 +123,7 @@ describe(`${ServerInfoController.name} (e2e)`, () => {
|
||||
|
||||
it('should return the server stats', async () => {
|
||||
const { status, body } = await request(server)
|
||||
.get('/server-info/stats')
|
||||
.get('/server-info/statistics')
|
||||
.set('Authorization', `Bearer ${accessToken}`);
|
||||
expect(status).toBe(200);
|
||||
expect(body).toEqual({
|
||||
|
||||
@@ -26,7 +26,7 @@ export const newAssetRepositoryMock = (): jest.Mocked<IAssetRepository> => {
|
||||
findLivePhotoMatch: jest.fn(),
|
||||
getMapMarkers: jest.fn(),
|
||||
getStatistics: jest.fn(),
|
||||
getByTimeBucket: jest.fn(),
|
||||
getTimeBucket: jest.fn(),
|
||||
getTimeBuckets: jest.fn(),
|
||||
restoreAll: jest.fn(),
|
||||
softDeleteAll: jest.fn(),
|
||||
|
||||
Reference in New Issue
Block a user