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:
Jason Rasmussen
2023-11-03 21:33:15 -04:00
committed by GitHub
parent d4ef6f52bb
commit 2e424fe249
72 changed files with 1974 additions and 1952 deletions

View File

@@ -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({

View File

@@ -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(),