Browse Source

fix path and add test for duplicateDecendants

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

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

@@ -165,7 +165,7 @@ describe('PageService', () => {
     await Revision.insertMany([
     await Revision.insertMany([
       {
       {
         _id: '600d395667536503354cbe91',
         _id: '600d395667536503354cbe91',
-        path: parentForDuplicate,
+        path: parentForDuplicate.path,
         body: 'duplicateBody',
         body: 'duplicateBody',
       },
       },
     ]);
     ]);
@@ -332,8 +332,12 @@ describe('PageService', () => {
       expect(resultPageRecursivly.tags).toEqual([originTagsMock().name]);
       expect(resultPageRecursivly.tags).toEqual([originTagsMock().name]);
     });
     });
 
 
-    test('duplicateDescendants()', () => {
-      expect(3).toBe(3);
+    test('duplicateDescendants()', async() => {
+      await crowi.pageService.duplicateDescendants([parentForDuplicate], testUser1, parentForDuplicate.path, '/newPathPrefix');
+
+      const insertedPage = await Page.findOne({ path: '/newPathPrefix' });
+
+      expect([insertedPage]).toHaveLength(1);
     });
     });
 
 
     test('duplicateTags()', async() => {
     test('duplicateTags()', async() => {