|
|
@@ -240,6 +240,25 @@ describe('PageService', () => {
|
|
|
xssSpy = jest.spyOn(crowi.xss, 'process').mockImplementation(path => path);
|
|
|
});
|
|
|
|
|
|
+ describe('rename page without using renameDescendantsWithStreamSpy', () => {
|
|
|
+ let pageEventSpy;
|
|
|
+ beforeEach(async() => {
|
|
|
+ pageEventSpy = jest.spyOn(crowi.pageService.pageEvent, 'emit').mockImplementation();
|
|
|
+ });
|
|
|
+
|
|
|
+ describe('renamePage()', () => {
|
|
|
+ test('rename page with different tree with isRecursively', async() => {
|
|
|
+ const resultPage = await crowi.pageService.renamePage(parentForRename6, '/parentForRename6/renamedChild', testUser1, {}, true);
|
|
|
+ const wrongPage = await Page.findOne({ path: '/parentForRename6/renamedChild/renamedChild' });
|
|
|
+ const expectPage = await Page.findOne({ path: '/parentForRename6/renamedChild' });
|
|
|
+
|
|
|
+ expect(resultPage.path).toEqual(expectPage.path);
|
|
|
+ expect(wrongPage).toBeNull();
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
describe('rename page', () => {
|
|
|
let pageEventSpy;
|
|
|
let renameDescendantsWithStreamSpy;
|
|
|
@@ -404,25 +423,6 @@ describe('PageService', () => {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- describe('rename page without using renameDescendantsWithStreamSpy', () => {
|
|
|
- let pageEventSpy;
|
|
|
- beforeEach(async() => {
|
|
|
- pageEventSpy = jest.spyOn(crowi.pageService.pageEvent, 'emit').mockImplementation();
|
|
|
- });
|
|
|
-
|
|
|
- describe('renamePage()', () => {
|
|
|
- test('rename page with different tree with isRecursively', async() => {
|
|
|
- const resultPage = await crowi.pageService.renamePage(parentForRename6, '/parentForRename6/renamedChild', testUser1, {}, true);
|
|
|
- const wrongPage = await Page.findOne({ path: '/parentForRename6/renamedChild/renamedChild' });
|
|
|
- const expectPage = await Page.findOne({ path: '/parentForRename6/renamedChild' });
|
|
|
-
|
|
|
- expect(resultPage.path).toEqual(expectPage.path);
|
|
|
- expect(wrongPage).toBeNull();
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- });
|
|
|
-
|
|
|
describe('duplicate page', () => {
|
|
|
let duplicateDescendantsWithStreamSpy;
|
|
|
|