Просмотр исходного кода

imprv test of
Any grant is allowed if parent is public

kaori 3 лет назад
Родитель
Сommit
dcc11d5b50
1 измененных файлов с 16 добавлено и 1 удалено
  1. 16 1
      packages/app/test/integration/service/page-grant.test.js

+ 16 - 1
packages/app/test/integration/service/page-grant.test.js

@@ -456,12 +456,27 @@ describe('PageGrantService', () => {
 
 
     test('Any grant is allowed if parent is public', async() => {
     test('Any grant is allowed if parent is public', async() => {
       const userGroupRelation = await UserGroupRelation.findAllUserGroupIdsRelatedToUser(user1);
       const userGroupRelation = await UserGroupRelation.findAllUserGroupIdsRelatedToUser(user1);
-      const publicOnlyMePage = await Page.findOne({ path: pagePublicOnlyMePath });
 
 
+      // OnlyMe
+      const publicOnlyMePage = await Page.findOne({ path: pagePublicOnlyMePath });
       const publicOnlyMeRes = await pageGrantService.calcApplicableGrantData(publicOnlyMePage, user1);
       const publicOnlyMeRes = await pageGrantService.calcApplicableGrantData(publicOnlyMePage, user1);
       await expect(publicOnlyMeRes[PageGrant.GRANT_PUBLIC]).toBeNull();
       await expect(publicOnlyMeRes[PageGrant.GRANT_PUBLIC]).toBeNull();
       await expect(publicOnlyMeRes[PageGrant.GRANT_OWNER]).toBeNull();
       await expect(publicOnlyMeRes[PageGrant.GRANT_OWNER]).toBeNull();
       await expect(publicOnlyMeRes[PageGrant.GRANT_USER_GROUP]).toEqual(userGroupRelation);
       await expect(publicOnlyMeRes[PageGrant.GRANT_USER_GROUP]).toEqual(userGroupRelation);
+
+      // AnyoneWithTheLink
+      const publicAnyoneWithTheLinkPage = await Page.findOne({ path: pagePublicAnyoneWithTheLinkPath });
+      const publicAnyoneWithTheLinkRes = await pageGrantService.calcApplicableGrantData(publicAnyoneWithTheLinkPage, user1);
+      await expect(publicAnyoneWithTheLinkRes[PageGrant.GRANT_PUBLIC]).toBeNull();
+      await expect(publicAnyoneWithTheLinkRes[PageGrant.GRANT_OWNER]).toBeNull();
+      await expect(publicAnyoneWithTheLinkRes[PageGrant.GRANT_USER_GROUP]).toEqual(userGroupRelation);
+
+      // OnlyInsideTheGroup
+      const publicOnlyInsideTheGroupPage = await Page.findOne({ path: pagePublicOnlyInsideTheGroupPath });
+      const publicOnlyInsideTheGroupRes = await pageGrantService.calcApplicableGrantData(publicOnlyInsideTheGroupPage, user1);
+      await expect(publicOnlyInsideTheGroupRes[PageGrant.GRANT_PUBLIC]).toBeNull();
+      await expect(publicOnlyInsideTheGroupRes[PageGrant.GRANT_OWNER]).toBeNull();
+      await expect(publicOnlyInsideTheGroupRes[PageGrant.GRANT_USER_GROUP]).toEqual(userGroupRelation);
     });
     });
   });
   });