Browse Source

clean code

zahmis 5 years ago
parent
commit
5b7d21056f
1 changed files with 3 additions and 16 deletions
  1. 3 16
      src/test/service/page.test.js

+ 3 - 16
src/test/service/page.test.js

@@ -429,29 +429,16 @@ describe('PageService', () => {
     });
 
     test('duplicateTags()', async() => {
-
-      const newPageDummy = [{
-        _id: '60110bdd85339d7dc732dddd',
-        path: '/newPageDummyPath',
-        creator: parentForDuplicate._id,
-        grant: parentForDuplicate.grant,
-        grantedGroup: parentForDuplicate.grantedGroup,
-        grantedUsers: parentForDuplicate.grantedUsers,
-        lastUpdateUser: parentForDuplicate._id,
-        redirectTo: null,
-        revision: parentForDuplicate.revisionId,
-      }];
-
       const pageIdMapping = {
         [parentForDuplicate._id]: '60110bdd85339d7dc732dddd',
       };
 
       const duplicateTagsReturn = await crowi.pageService.duplicateTags(pageIdMapping);
-      const parentoForDuplicateTags = await PageTagRelation.find({ relatedPage: parentForDuplicate });
-      const pageTagRelationAfterDuplicated = await PageTagRelation.find({ relatedPage: newPageDummy });
+      const parentoForDuplicateTags = await PageTagRelation.findOne({ relatedPage: parentForDuplicate });
+      const pageTagRelationAfterDuplicated = await PageTagRelation.findOne({ relatedPage: duplicateTagsReturn[0].relatedPage });
 
       expect(duplicateTagsReturn).toHaveLength(1);
-      expect(pageTagRelationAfterDuplicated.relatedTag).toEqual(parentoForDuplicateTags.relatedTag);
+      expect(pageTagRelationAfterDuplicated.relatedTag[0]).toEqual(parentoForDuplicateTags.relatedTag[0]);
     });
   });