From 5fc6265b7712aaa9b88f5c8036d27900f4d87a0b Mon Sep 17 00:00:00 2001 From: David Mehren Date: Sun, 12 Feb 2023 19:37:20 +0100 Subject: [PATCH] test(public/notes): update tests for default groups Signed-off-by: David Mehren --- backend/test/public-api/notes.e2e-spec.ts | 27 +++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/backend/test/public-api/notes.e2e-spec.ts b/backend/test/public-api/notes.e2e-spec.ts index bf43f1f40..4cf0817e9 100644 --- a/backend/test/public-api/notes.e2e-spec.ts +++ b/backend/test/public-api/notes.e2e-spec.ts @@ -130,6 +130,7 @@ describe('Notes', () => { ); await request(testSetup.app.getHttpServer()) .post('/api/v2/notes/test2') + .set('Authorization', `Bearer ${testSetup.authTokens[0].secret}`) .set('Content-Type', 'text/markdown') .send(content) .expect('Content-Type', /json/) @@ -540,7 +541,16 @@ describe('Notes', () => { .expect(200); expect(permissions.body.owner).toBe('testuser1'); expect(permissions.body.sharedToUsers).toEqual([]); - expect(permissions.body.sharedToGroups).toEqual([]); + expect(permissions.body.sharedToGroups).toEqual([ + { + groupName: '_EVERYONE', + canEdit: false, + }, + { + canEdit: true, + groupName: '_LOGGED_IN', + }, + ]); }); it('can be updated', async function () { // add permission for testuser2 @@ -561,7 +571,16 @@ describe('Notes', () => { expect(permissions.body.sharedToUsers).toEqual([ { username: 'testuser2', canEdit: true }, ]); - expect(permissions.body.sharedToGroups).toEqual([]); + expect(permissions.body.sharedToGroups).toEqual([ + { + groupName: '_EVERYONE', + canEdit: false, + }, + { + canEdit: true, + groupName: '_LOGGED_IN', + }, + ]); // add permission for everyone await request(testSetup.app.getHttpServer()) @@ -583,6 +602,10 @@ describe('Notes', () => { ]); expect(permissions.body.sharedToGroups).toEqual([ { groupName: '_EVERYONE', canEdit: true }, + { + canEdit: true, + groupName: '_LOGGED_IN', + }, ]); }); });