|
|
@@ -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;
|