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

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

@@ -35,12 +35,14 @@ describe('PageGrantService', () => {
   let groupChild;
   let groupChild;
   let groupAB;
   let groupAB;
   let groupA;
   let groupA;
+  let groupAIsolated;
   let groupB;
   let groupB;
   let groupC;
   let groupC;
 
 
   const userGroupIdParent = new mongoose.Types.ObjectId();
   const userGroupIdParent = new mongoose.Types.ObjectId();
 
 
   const userGroupIdA = new mongoose.Types.ObjectId();
   const userGroupIdA = new mongoose.Types.ObjectId();
+  const userGroupIdAIsolated = new mongoose.Types.ObjectId();
   const userGroupIdB = new mongoose.Types.ObjectId();
   const userGroupIdB = new mongoose.Types.ObjectId();
   const userGroupIdC = new mongoose.Types.ObjectId();
   const userGroupIdC = new mongoose.Types.ObjectId();
   const userGroupIdAB = new mongoose.Types.ObjectId();
   const userGroupIdAB = new mongoose.Types.ObjectId();
@@ -141,6 +143,11 @@ describe('PageGrantService', () => {
         name: 'GroupA',
         name: 'GroupA',
         parent: userGroupIdAB,
         parent: userGroupIdAB,
       },
       },
+      {
+        _id: userGroupIdAIsolated,
+        name: 'GroupAIsolated',
+        parent: null, // isolated
+      },
       {
       {
         _id: userGroupIdB,
         _id: userGroupIdB,
         name: 'GroupB',
         name: 'GroupB',
@@ -155,6 +162,11 @@ describe('PageGrantService', () => {
 
 
     groupParent = await UserGroup.findOne({ name: 'GroupParent' });
     groupParent = await UserGroup.findOne({ name: 'GroupParent' });
     groupChild = await UserGroup.findOne({ name: 'GroupChild' });
     groupChild = await UserGroup.findOne({ name: 'GroupChild' });
+    groupAB = await UserGroup.findOne({ name: 'GroupAB' });
+    groupA = await UserGroup.findOne({ name: 'GroupA' });
+    groupAIsolated = await UserGroup.findOne({ name: 'GroupAIsolated' });
+    groupB = await UserGroup.findOne({ name: 'GroupB' });
+    groupC = await UserGroup.findOne({ name: 'GroupC' });
 
 
     // UserGroupRelations
     // UserGroupRelations
     await UserGroupRelation.insertMany([
     await UserGroupRelation.insertMany([
@@ -185,6 +197,10 @@ describe('PageGrantService', () => {
         relatedGroup: userGroupIdA,
         relatedGroup: userGroupIdA,
         relatedUser: userA._id,
         relatedUser: userA._id,
       },
       },
+      {
+        relatedGroup: userGroupIdAIsolated,
+        relatedUser: userA._id,
+      },
       {
       {
         relatedGroup: userGroupIdB,
         relatedGroup: userGroupIdB,
         relatedUser: userB._id,
         relatedUser: userB._id,