|
@@ -293,7 +293,7 @@ describe('PageService', () => {
|
|
|
|
|
|
|
|
describe('rename page without using renameDescendantsWithStreamSpy', () => {
|
|
describe('rename page without using renameDescendantsWithStreamSpy', () => {
|
|
|
test('rename page with different tree with isRecursively [deeper]', async() => {
|
|
test('rename page with different tree with isRecursively [deeper]', async() => {
|
|
|
- const resultPage = await crowi.pageService.renamePage(parentForRename6, '/parentForRename6/renamedChild', testUser1, {});
|
|
|
|
|
|
|
+ const resultPage = await crowi.pageService.renamePage(parentForRename6, '/parentForRename6/renamedChild', testUser1, { isRecursively: true });
|
|
|
const wrongPage = await Page.findOne({ path: '/parentForRename6/renamedChild/renamedChild' });
|
|
const wrongPage = await Page.findOne({ path: '/parentForRename6/renamedChild/renamedChild' });
|
|
|
const expectPage1 = await Page.findOne({ path: '/parentForRename6/renamedChild' });
|
|
const expectPage1 = await Page.findOne({ path: '/parentForRename6/renamedChild' });
|
|
|
const expectPage2 = await Page.findOne({ path: '/parentForRename6-2021H1' });
|
|
const expectPage2 = await Page.findOne({ path: '/parentForRename6-2021H1' });
|
|
@@ -315,7 +315,7 @@ describe('PageService', () => {
|
|
|
|
|
|
|
|
// when
|
|
// when
|
|
|
// rename /level1/level2 --> /level1
|
|
// rename /level1/level2 --> /level1
|
|
|
- await crowi.pageService.renamePage(parentForRename7, '/level1', testUser1, {});
|
|
|
|
|
|
|
+ await crowi.pageService.renamePage(parentForRename7, '/level1', testUser1, { isRecursively: true });
|
|
|
|
|
|
|
|
// then
|
|
// then
|
|
|
expect(await Page.findOne({ path: '/level1' })).not.toBeNull();
|
|
expect(await Page.findOne({ path: '/level1' })).not.toBeNull();
|
|
@@ -348,7 +348,6 @@ describe('PageService', () => {
|
|
|
const resultPage = await crowi.pageService.renamePage(parentForRename1, '/renamed1', testUser2, {});
|
|
const resultPage = await crowi.pageService.renamePage(parentForRename1, '/renamed1', testUser2, {});
|
|
|
|
|
|
|
|
expect(xssSpy).toHaveBeenCalled();
|
|
expect(xssSpy).toHaveBeenCalled();
|
|
|
- expect(renameDescendantsWithStreamSpy).toHaveBeenCalled(); // single rename is deprecated
|
|
|
|
|
|
|
|
|
|
expect(pageEventSpy).toHaveBeenCalledWith('rename', parentForRename1, testUser2);
|
|
expect(pageEventSpy).toHaveBeenCalledWith('rename', parentForRename1, testUser2);
|
|
|
|
|
|
|
@@ -362,7 +361,6 @@ describe('PageService', () => {
|
|
|
const resultPage = await crowi.pageService.renamePage(parentForRename2, '/renamed2', testUser2, { updateMetadata: true });
|
|
const resultPage = await crowi.pageService.renamePage(parentForRename2, '/renamed2', testUser2, { updateMetadata: true });
|
|
|
|
|
|
|
|
expect(xssSpy).toHaveBeenCalled();
|
|
expect(xssSpy).toHaveBeenCalled();
|
|
|
- expect(renameDescendantsWithStreamSpy).toHaveBeenCalled();
|
|
|
|
|
|
|
|
|
|
expect(pageEventSpy).toHaveBeenCalledWith('rename', parentForRename2, testUser2);
|
|
expect(pageEventSpy).toHaveBeenCalledWith('rename', parentForRename2, testUser2);
|
|
|
|
|
|
|
@@ -376,7 +374,6 @@ describe('PageService', () => {
|
|
|
const resultPage = await crowi.pageService.renamePage(parentForRename3, '/renamed3', testUser2, { createRedirectPage: true });
|
|
const resultPage = await crowi.pageService.renamePage(parentForRename3, '/renamed3', testUser2, { createRedirectPage: true });
|
|
|
|
|
|
|
|
expect(xssSpy).toHaveBeenCalled();
|
|
expect(xssSpy).toHaveBeenCalled();
|
|
|
- expect(renameDescendantsWithStreamSpy).toHaveBeenCalled();
|
|
|
|
|
expect(pageEventSpy).toHaveBeenCalledWith('rename', parentForRename3, testUser2);
|
|
expect(pageEventSpy).toHaveBeenCalledWith('rename', parentForRename3, testUser2);
|
|
|
|
|
|
|
|
expect(resultPage.path).toBe('/renamed3');
|
|
expect(resultPage.path).toBe('/renamed3');
|
|
@@ -386,7 +383,7 @@ describe('PageService', () => {
|
|
|
|
|
|
|
|
test('rename page with isRecursively', async() => {
|
|
test('rename page with isRecursively', async() => {
|
|
|
|
|
|
|
|
- const resultPage = await crowi.pageService.renamePage(parentForRename4, '/renamed4', testUser2, { }, true);
|
|
|
|
|
|
|
+ const resultPage = await crowi.pageService.renamePage(parentForRename4, '/renamed4', testUser2, { isRecursively: true });
|
|
|
|
|
|
|
|
expect(xssSpy).toHaveBeenCalled();
|
|
expect(xssSpy).toHaveBeenCalled();
|
|
|
expect(renameDescendantsWithStreamSpy).toHaveBeenCalled();
|
|
expect(renameDescendantsWithStreamSpy).toHaveBeenCalled();
|
|
@@ -399,7 +396,7 @@ describe('PageService', () => {
|
|
|
|
|
|
|
|
test('rename page with different tree with isRecursively', async() => {
|
|
test('rename page with different tree with isRecursively', async() => {
|
|
|
|
|
|
|
|
- const resultPage = await crowi.pageService.renamePage(parentForRename5, '/parentForRename5/renamedChild', testUser1, {}, true);
|
|
|
|
|
|
|
+ const resultPage = await crowi.pageService.renamePage(parentForRename5, '/parentForRename5/renamedChild', testUser1, { isRecursively: true });
|
|
|
const wrongPage = await Page.findOne({ path: '/parentForRename5/renamedChild/renamedChild' });
|
|
const wrongPage = await Page.findOne({ path: '/parentForRename5/renamedChild/renamedChild' });
|
|
|
const expectPage = await Page.findOne({ path: '/parentForRename5/renamedChild' });
|
|
const expectPage = await Page.findOne({ path: '/parentForRename5/renamedChild' });
|
|
|
|
|
|