yohei0125 4 лет назад
Родитель
Сommit
2a7dcd124a
1 измененных файлов с 4 добавлено и 6 удалено
  1. 4 6
      packages/app/test/integration/service/pagev5.test.ts

+ 4 - 6
packages/app/test/integration/service/pagev5.test.ts

@@ -64,13 +64,11 @@ describe('PageService page operations with only public pages', () => {
 
     xssSpy = jest.spyOn(crowi.xss, 'process').mockImplementation(path => path);
 
-    // delete root page if any created by other test file
-    const pages = await Page.find({ path: '/' });
-    if (pages.length > 0) {
-      await Page.deleteOne({ path: '/' });
+    rootPage = await Page.findOne({ path: '/' });
+    if (rootPage == null) {
+      const pages = await Page.insertMany([{ path: '/', grant: Page.GRANT_PUBLIC }]);
+      rootPage = pages[0];
     }
-    // then create new root page
-    rootPage = await Page.create('/', 'body', dummyUser1._id, {});
 
     /*
      * Rename