|
|
@@ -842,19 +842,19 @@ 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 mockedRenameSubOperation = jest.spyOn(crowi.pageService, 'renameSubOperation').mockReturnValue(null);
|
|
|
const mockedCreateAndSendNotifications = jest.spyOn(crowi.pageService, 'createAndSendNotifications').mockReturnValue(null);
|
|
|
const renamedPage = await crowi.pageService.renamePage(page, newPagePath, user, options);
|
|
|
|
|
|
- // retrieve the arguments passed when calling method resumableRenameDescendants inside renamePage method
|
|
|
- const argsForResumableRenameDescendants = mockedResumableRenameDescendants.mock.calls[0];
|
|
|
+ // retrieve the arguments passed when calling method renameSubOperation inside renamePage method
|
|
|
+ const argsForRenameSubOperation = mockedRenameSubOperation.mock.calls[0];
|
|
|
|
|
|
// restores the original implementation
|
|
|
- mockedResumableRenameDescendants.mockRestore();
|
|
|
+ mockedRenameSubOperation.mockRestore();
|
|
|
mockedCreateAndSendNotifications.mockRestore();
|
|
|
|
|
|
// rename descendants
|
|
|
- await crowi.pageService.resumableRenameDescendants(...argsForResumableRenameDescendants);
|
|
|
+ await crowi.pageService.renameSubOperation(...argsForRenameSubOperation);
|
|
|
|
|
|
return renamedPage;
|
|
|
};
|
|
|
@@ -1004,20 +1004,20 @@ describe('PageService page operations with only public pages', () => {
|
|
|
|
|
|
const duplicate = async(page, newPagePath, user, isRecursively) => {
|
|
|
// mock return value
|
|
|
- const mockedResumableDuplicateDescendants = jest.spyOn(crowi.pageService, 'resumableDuplicateDescendants').mockReturnValue(null);
|
|
|
+ const mockedDuplicateRecursivelyMainOperation = jest.spyOn(crowi.pageService, 'duplicateRecursivelyMainOperation').mockReturnValue(null);
|
|
|
const mockedCreateAndSendNotifications = jest.spyOn(crowi.pageService, 'createAndSendNotifications').mockReturnValue(null);
|
|
|
const duplicatedPage = await crowi.pageService.duplicate(page, newPagePath, user, isRecursively);
|
|
|
|
|
|
- // retrieve the arguments passed when calling method resumableDuplicateDescendants inside duplicate method
|
|
|
- const argsForResumableDuplicateDescendants = mockedResumableDuplicateDescendants.mock.calls[0];
|
|
|
+ // retrieve the arguments passed when calling method duplicateRecursivelyMainOperation inside duplicate method
|
|
|
+ const argsForDuplicateRecursivelyMainOperation = mockedDuplicateRecursivelyMainOperation.mock.calls[0];
|
|
|
|
|
|
// restores the original implementation
|
|
|
- mockedResumableDuplicateDescendants.mockRestore();
|
|
|
+ mockedDuplicateRecursivelyMainOperation.mockRestore();
|
|
|
mockedCreateAndSendNotifications.mockRestore();
|
|
|
|
|
|
// duplicate descendants
|
|
|
if (isRecursively) {
|
|
|
- await crowi.pageService.resumableDuplicateDescendants(...argsForResumableDuplicateDescendants);
|
|
|
+ await crowi.pageService.duplicateRecursivelyMainOperation(...argsForDuplicateRecursivelyMainOperation);
|
|
|
}
|
|
|
|
|
|
return duplicatedPage;
|
|
|
@@ -1165,18 +1165,18 @@ describe('PageService page operations with only public pages', () => {
|
|
|
});
|
|
|
describe('Delete', () => {
|
|
|
const deletePage = async(page, user, options, isRecursively) => {
|
|
|
- const mockedResumableDeleteDescendants = jest.spyOn(crowi.pageService, 'resumableDeleteDescendants').mockReturnValue(null);
|
|
|
+ const mockedDeleteRecursivelyMainOperation = jest.spyOn(crowi.pageService, 'deleteRecursivelyMainOperation').mockReturnValue(null);
|
|
|
const mockedCreateAndSendNotifications = jest.spyOn(crowi.pageService, 'createAndSendNotifications').mockReturnValue(null);
|
|
|
|
|
|
const deletedPage = await crowi.pageService.deletePage(page, user, options, isRecursively);
|
|
|
|
|
|
- const argsForResumableDeleteDescendants = mockedResumableDeleteDescendants.mock.calls[0];
|
|
|
+ const argsForDeleteRecursivelyMainOperation = mockedDeleteRecursivelyMainOperation.mock.calls[0];
|
|
|
|
|
|
- mockedResumableDeleteDescendants.mockRestore();
|
|
|
+ mockedDeleteRecursivelyMainOperation.mockRestore();
|
|
|
mockedCreateAndSendNotifications.mockRestore();
|
|
|
|
|
|
if (isRecursively) {
|
|
|
- await crowi.pageService.resumableDeleteDescendants(...argsForResumableDeleteDescendants);
|
|
|
+ await crowi.pageService.deleteRecursivelyMainOperation(...argsForDeleteRecursivelyMainOperation);
|
|
|
}
|
|
|
|
|
|
return deletedPage;
|
|
|
@@ -1280,18 +1280,18 @@ describe('PageService page operations with only public pages', () => {
|
|
|
|
|
|
describe('Delete completely', () => {
|
|
|
const deleteCompletely = async(page, user, options = {}, isRecursively = false, preventEmitting = false) => {
|
|
|
- const mockedResumableDeleteCompletelyDescendants = jest.spyOn(crowi.pageService, 'resumableDeleteCompletelyDescendants').mockReturnValue(null);
|
|
|
+ const mockedDeleteCompletelyRecursivelyMainOperation = jest.spyOn(crowi.pageService, 'deleteCompletelyRecursivelyMainOperation').mockReturnValue(null);
|
|
|
const mockedCreateAndSendNotifications = jest.spyOn(crowi.pageService, 'createAndSendNotifications').mockReturnValue(null);
|
|
|
|
|
|
await crowi.pageService.deleteCompletely(page, user, options, isRecursively, preventEmitting);
|
|
|
|
|
|
- const argsForResumableDeleteDescendants = mockedResumableDeleteCompletelyDescendants.mock.calls[0];
|
|
|
+ const argsForDeleteCompletelyRecursivelyMainOperation = mockedDeleteCompletelyRecursivelyMainOperation.mock.calls[0];
|
|
|
|
|
|
- mockedResumableDeleteCompletelyDescendants.mockRestore();
|
|
|
+ mockedDeleteCompletelyRecursivelyMainOperation.mockRestore();
|
|
|
mockedCreateAndSendNotifications.mockRestore();
|
|
|
|
|
|
if (isRecursively) {
|
|
|
- await crowi.pageService.resumableDeleteCompletelyDescendants(...argsForResumableDeleteDescendants);
|
|
|
+ await crowi.pageService.deleteCompletelyRecursivelyMainOperation(...argsForDeleteCompletelyRecursivelyMainOperation);
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
@@ -1382,9 +1382,9 @@ describe('PageService page operations with only public pages', () => {
|
|
|
expectAllToBeTruthy([parentPage, childPage, grandchildPage]);
|
|
|
|
|
|
await deleteCompletely(childPage, dummyUser1, {}, false);
|
|
|
- const parentPageAfterDelete = await Page.findOne({ path: parentPage.path });
|
|
|
- const childPageAfterDelete = await Page.findOne({ path: childPage.path });
|
|
|
- const grandchildPageAfterDelete = await Page.findOne({ path: grandchildPage.path });
|
|
|
+ const parentPageAfterDelete = await Page.findOne({ path: '/v5_PageForDeleteCompletely6' });
|
|
|
+ const childPageAfterDelete = await Page.findOne({ path: '/v5_PageForDeleteCompletely6/v5_PageForDeleteCompletely7' });
|
|
|
+ const grandchildPageAfterDelete = await Page.findOne({ path: '/v5_PageForDeleteCompletely6/v5_PageForDeleteCompletely7/v5_PageForDeleteCompletely8' });
|
|
|
const childOfDeletedPage = await Page.findOne({ parent: childPageAfterDelete._id });
|
|
|
|
|
|
expectAllToBeTruthy([parentPageAfterDelete, childPageAfterDelete, grandchildPageAfterDelete]);
|
|
|
@@ -1400,15 +1400,15 @@ describe('PageService page operations with only public pages', () => {
|
|
|
describe('revert', () => {
|
|
|
const revertDeletedPage = async(page, user, options = {}, isRecursively = false) => {
|
|
|
// mock return value
|
|
|
- const mockedResumableRevertDeletedDescendants = jest.spyOn(crowi.pageService, 'resumableRevertDeletedDescendants').mockReturnValue(null);
|
|
|
+ const mockedRevertRecursivelyMainOperation = jest.spyOn(crowi.pageService, 'revertRecursivelyMainOperation').mockReturnValue(null);
|
|
|
const revertedPage = await crowi.pageService.revertDeletedPage(page, user, options, isRecursively);
|
|
|
|
|
|
- const argsForResumableRevertDeletedDescendants = mockedResumableRevertDeletedDescendants.mock.calls[0];
|
|
|
+ const argsForRecursivelyMainOperation = mockedRevertRecursivelyMainOperation.mock.calls[0];
|
|
|
|
|
|
// restores the original implementation
|
|
|
- mockedResumableRevertDeletedDescendants.mockRestore();
|
|
|
+ mockedRevertRecursivelyMainOperation.mockRestore();
|
|
|
if (isRecursively) {
|
|
|
- await crowi.pageService.resumableRevertDeletedDescendants(...argsForResumableRevertDeletedDescendants);
|
|
|
+ await crowi.pageService.revertRecursivelyMainOperation(...argsForRecursivelyMainOperation);
|
|
|
}
|
|
|
|
|
|
return revertedPage;
|