|
@@ -0,0 +1,80 @@
|
|
|
|
|
+import mongoose from 'mongoose';
|
|
|
|
|
+
|
|
|
|
|
+import { getInstance } from '../setup-crowi';
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+describe('Test page service methods', () => {
|
|
|
|
|
+ let crowi;
|
|
|
|
|
+ let Page;
|
|
|
|
|
+ let Revision;
|
|
|
|
|
+ let User;
|
|
|
|
|
+ let UserGroup;
|
|
|
|
|
+ let UserGroupRelation;
|
|
|
|
|
+ let Tag;
|
|
|
|
|
+ let PageTagRelation;
|
|
|
|
|
+ let Bookmark;
|
|
|
|
|
+ let Comment;
|
|
|
|
|
+ let ShareLink;
|
|
|
|
|
+ let PageRedirect;
|
|
|
|
|
+ let xssSpy;
|
|
|
|
|
+
|
|
|
|
|
+ let rootPage;
|
|
|
|
|
+
|
|
|
|
|
+ let dummyUser1;
|
|
|
|
|
+ let dummyUser2;
|
|
|
|
|
+ let globalGroupUser1;
|
|
|
|
|
+ let globalGroupUser2;
|
|
|
|
|
+ let globalGroupUser3;
|
|
|
|
|
+ let globalGroupIsolate;
|
|
|
|
|
+ let globalGroupA;
|
|
|
|
|
+ let globalGroupB;
|
|
|
|
|
+ let globalGroupC;
|
|
|
|
|
+
|
|
|
|
|
+ beforeAll(async() => {
|
|
|
|
|
+ crowi = await getInstance();
|
|
|
|
|
+ await crowi.configManager.updateConfigsInTheSameNamespace('crowi', { 'app:isV5Compatible': true });
|
|
|
|
|
+
|
|
|
|
|
+ User = mongoose.model('User');
|
|
|
|
|
+ UserGroup = mongoose.model('UserGroup');
|
|
|
|
|
+ UserGroupRelation = mongoose.model('UserGroupRelation');
|
|
|
|
|
+ Page = mongoose.model('Page');
|
|
|
|
|
+ Revision = mongoose.model('Revision');
|
|
|
|
|
+ Tag = mongoose.model('Tag');
|
|
|
|
|
+ PageTagRelation = mongoose.model('PageTagRelation');
|
|
|
|
|
+ Bookmark = mongoose.model('Bookmark');
|
|
|
|
|
+ Comment = mongoose.model('Comment');
|
|
|
|
|
+ ShareLink = mongoose.model('ShareLink');
|
|
|
|
|
+ PageRedirect = mongoose.model('PageRedirect');
|
|
|
|
|
+ UserGroup = mongoose.model('UserGroup');
|
|
|
|
|
+ UserGroupRelation = mongoose.model('UserGroupRelation');
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Common
|
|
|
|
|
+ */
|
|
|
|
|
+ xssSpy = jest.spyOn(crowi.xss, 'process').mockImplementation(path => path);
|
|
|
|
|
+
|
|
|
|
|
+ // ***********************************************************************************************************
|
|
|
|
|
+ // * Do NOT change properties of globally used documents. Otherwise, it might cause some errors in other tests
|
|
|
|
|
+ // ***********************************************************************************************************
|
|
|
|
|
+ // users
|
|
|
|
|
+ dummyUser1 = await User.findOne({ username: 'v5DummyUser1' });
|
|
|
|
|
+ dummyUser2 = await User.findOne({ username: 'v5DummyUser2' });
|
|
|
|
|
+ globalGroupUser1 = await User.findOne({ username: 'gGroupUser1' });
|
|
|
|
|
+ globalGroupUser2 = await User.findOne({ username: 'gGroupUser2' });
|
|
|
|
|
+ globalGroupUser3 = await User.findOne({ username: 'gGroupUser3' });
|
|
|
|
|
+ // groups
|
|
|
|
|
+ globalGroupIsolate = await UserGroup.findOne({ name: 'globalGroupIsolate' });
|
|
|
|
|
+ globalGroupA = await UserGroup.findOne({ name: 'globalGroupA' });
|
|
|
|
|
+ globalGroupB = await UserGroup.findOne({ name: 'globalGroupB' });
|
|
|
|
|
+ globalGroupC = await UserGroup.findOne({ name: 'globalGroupC' });
|
|
|
|
|
+ // page
|
|
|
|
|
+ rootPage = await Page.findOne({ path: '/' });
|
|
|
|
|
+
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ describe('restart renameOperation', () => {
|
|
|
|
|
+ test('it should successfully restart rename operation when ActionType of unfinished PageOperation is Main', async() => {});
|
|
|
|
|
+ test('it should successfully restart rename operation when ActionType of unfinished PageOperation is Sub', async() => {});
|
|
|
|
|
+ test('it should fail when PageOperation is not found', async() => {});
|
|
|
|
|
+ });
|
|
|
|
|
+});
|