test(public/notes): update tests for default groups

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2023-02-12 19:37:20 +01:00 committed by Yannick Bungers
parent 679d8a8655
commit 5fc6265b77

View file

@ -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',
},
]);
});
});