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

move renamePageFn into describe('Rename')

yohei0125 4 лет назад
Родитель
Сommit
59343cdb1c
1 измененных файлов с 15 добавлено и 15 удалено
  1. 15 15
      packages/app/test/integration/service/pagev5.test.ts

+ 15 - 15
packages/app/test/integration/service/pagev5.test.ts

@@ -222,27 +222,27 @@ describe('PageService page operations with only public pages', () => {
 
   });
 
-  const renamePage = async(page, newPagePath, user, options) => {
-    // mock return value
-    const mockedResumableRenameDescendants = jest.spyOn(crowi.pageService, 'resumableRenameDescendants').mockReturnValue(null);
-    const mockedCreateAndSendNotifications = jest.spyOn(crowi.pageService, 'createAndSendNotifications').mockReturnValue(null);
-    const renamedPage = await crowi.pageService.renamePage(page, newPagePath, user, options);
+  describe('Rename', () => {
 
-    // retrieve the arguments passed when calling method resumableRenameDescendants inside renamePage method
-    const argsForCreateAndSendNotifications = mockedResumableRenameDescendants.mock.calls[0];
+    const renamePage = async(page, newPagePath, user, options) => {
+    // mock return value
+      const mockedResumableRenameDescendants = jest.spyOn(crowi.pageService, 'resumableRenameDescendants').mockReturnValue(null);
+      const mockedCreateAndSendNotifications = jest.spyOn(crowi.pageService, 'createAndSendNotifications').mockReturnValue(null);
+      const renamedPage = await crowi.pageService.renamePage(page, newPagePath, user, options);
 
-    // restores the original implementation
-    mockedResumableRenameDescendants.mockRestore();
-    mockedCreateAndSendNotifications.mockRestore();
+      // retrieve the arguments passed when calling method resumableRenameDescendants inside renamePage method
+      const argsForCreateAndSendNotifications = mockedResumableRenameDescendants.mock.calls[0];
 
-    // rename descendants
-    await crowi.pageService.resumableRenameDescendants(...argsForCreateAndSendNotifications);
+      // restores the original implementation
+      mockedResumableRenameDescendants.mockRestore();
+      mockedCreateAndSendNotifications.mockRestore();
 
-    return renamedPage;
-  };
+      // rename descendants
+      await crowi.pageService.resumableRenameDescendants(...argsForCreateAndSendNotifications);
 
+      return renamedPage;
+    };
 
-  describe('Rename', () => {
     test('Should NOT rename top page', async() => {
 
       let isThrown = false;