فهرست منبع

improve setup-crowi.js

Yuki Takei 4 سال پیش
والد
کامیت
1ca2b4f036
1فایلهای تغییر یافته به همراه5 افزوده شده و 9 حذف شده
  1. 5 9
      packages/app/src/test/setup-crowi.js

+ 5 - 9
packages/app/src/test/setup-crowi.js

@@ -2,21 +2,17 @@ import Crowi from '~/server/crowi';
 
 
 let _instance = null;
 let _instance = null;
 
 
-async function createInstance() {
-  const crowi = new Crowi();
-  await crowi.initForTest();
-
-  return crowi;
-}
-
 async function getInstance(isNewInstance) {
 async function getInstance(isNewInstance) {
   if (isNewInstance) {
   if (isNewInstance) {
-    return createInstance();
+    const crowi = new Crowi();
+    await crowi.initForTest();
+    return crowi;
   }
   }
 
 
   // initialize singleton instance
   // initialize singleton instance
   if (_instance == null) {
   if (_instance == null) {
-    _instance = await createInstance();
+    _instance = new Crowi();
+    await _instance.initForTest();
   }
   }
   return _instance;
   return _instance;
 }
 }