From 142934b582ab7206c97be54d0441aab81e4a0dcc Mon Sep 17 00:00:00 2001 From: mgabor <> Date: Tue, 23 Apr 2024 11:03:36 +0200 Subject: [PATCH] add new test to check if viewer can see the album --- e2e/src/api/specs/album.e2e-spec.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/e2e/src/api/specs/album.e2e-spec.ts b/e2e/src/api/specs/album.e2e-spec.ts index b56a464d8c..608cf828dd 100644 --- a/e2e/src/api/specs/album.e2e-spec.ts +++ b/e2e/src/api/specs/album.e2e-spec.ts @@ -113,7 +113,6 @@ describe('/album', () => { updateAlbumUserDto: { role: AlbumUserRole.Editor }, }), ]); - albums[0].albumUsers[0].role = AlbumUserRole.Editor; albums[3].albumUsers[0].role = AlbumUserRole.Editor; albums[6].albumUsers[0].role = AlbumUserRole.Editor; @@ -334,7 +333,7 @@ describe('/album', () => { }); }); - it('should return album info for shared album', async () => { + it('should return album info for shared album (editor)', async () => { const { status, body } = await request(app) .get(`/album/${user2Albums[0].id}?withoutAssets=false`) .set('Authorization', `Bearer ${user1.accessToken}`); @@ -346,6 +345,19 @@ describe('/album', () => { }); }); + it('should return album info for shared album (viewer)', async () => { + const { status, body } = await request(app) + .get(`/album/${user1Albums[3].id}?withoutAssets=false`) + .set('Authorization', `Bearer ${user2.accessToken}`); + + expect(status).toBe(200); + console.log(body); + expect(body).toEqual({ + ...user1Albums[3], + assets: [expect.objectContaining({ id: user2Albums[0].assets[0].id })], + }); + }); + it('should return album info with assets when withoutAssets is undefined', async () => { const { status, body } = await request(app) .get(`/album/${user1Albums[0].id}`)