fix(server): get album's assets in getAlbumInfo route (#5325)

* fix(server): get album's assets in getAlbumInfo route

* unit test

* test: e2e tests
This commit is contained in:
Alex
2023-11-26 21:21:04 -06:00
committed by GitHub
parent 034b308ddc
commit 4e5eef129d
3 changed files with 26 additions and 4 deletions

View File

@@ -261,6 +261,28 @@ describe(`${AlbumController.name} (e2e)`, () => {
expect(status).toBe(200);
expect(body).toEqual(user2Albums[0]);
});
it('should return album info with assets when withoutAssets is undefined', async () => {
const { status, body } = await request(server)
.get(`/album/${user1Albums[0].id}`)
.set('Authorization', `Bearer ${user1.accessToken}`);
expect(status).toBe(200);
expect(body).toEqual(user1Albums[0]);
});
it('should return album info without assets when withoutAssets is true', async () => {
const { status, body } = await request(server)
.get(`/album/${user1Albums[0].id}?withoutAssets=true`)
.set('Authorization', `Bearer ${user1.accessToken}`);
expect(status).toBe(200);
expect(body).toEqual({
...user1Albums[0],
assets: [],
assetCount: 1,
});
});
});
describe('PUT /album/:id/assets', () => {