2
0
Эх сурвалжийг харах

fix test with current state of the branch

mizozobu 6 жил өмнө
parent
commit
1f3a013cb4

+ 5 - 5
src/server/crowi/index.js

@@ -118,7 +118,7 @@ Crowi.prototype.initForTest = async function() {
     // this.setUpSlacklNotification(),
     // this.setUpSlacklNotification(),
   ]);
   ]);
 
 
-  // await Promise.all([
+  await Promise.all([
   //   this.scanRuntimeVersions(),
   //   this.scanRuntimeVersions(),
   //   this.setupPassport(),
   //   this.setupPassport(),
   //   this.setupSearcher(),
   //   this.setupSearcher(),
@@ -127,10 +127,10 @@ Crowi.prototype.initForTest = async function() {
   //   this.setupCsrf(),
   //   this.setupCsrf(),
   //   this.setUpGlobalNotification(),
   //   this.setUpGlobalNotification(),
   //   this.setUpFileUpload(),
   //   this.setUpFileUpload(),
-  //   this.setUpAcl(),
+    this.setUpAcl(),
   //   this.setUpCustomize(),
   //   this.setUpCustomize(),
   //   this.setUpRestQiitaAPI(),
   //   this.setUpRestQiitaAPI(),
-  // ]);
+  ]);
 };
 };
 
 
 Crowi.prototype.isPageId = function(pageId) {
 Crowi.prototype.isPageId = function(pageId) {
@@ -474,7 +474,7 @@ Crowi.prototype.setUpXss = function() {
 /**
 /**
  * setup AclService
  * setup AclService
  */
  */
-Crowi.prototype.setUpAcl = function() {
+Crowi.prototype.setUpAcl = async function() {
   const AclService = require('../service/acl');
   const AclService = require('../service/acl');
   if (this.aclService == null) {
   if (this.aclService == null) {
     this.aclService = new AclService(this.configManager);
     this.aclService = new AclService(this.configManager);
@@ -496,7 +496,7 @@ Crowi.prototype.setUpCustomize = function() {
 /**
 /**
  * setup AppService
  * setup AppService
  */
  */
-Crowi.prototype.setUpApp = function() {
+Crowi.prototype.setUpApp = async function() {
   const AppService = require('../service/app');
   const AppService = require('../service/app');
   if (this.appService == null) {
   if (this.appService == null) {
     this.appService = new AppService(this.configManager);
     this.appService = new AppService(this.configManager);

+ 4 - 12
src/test/models/config.test.js

@@ -1,27 +1,19 @@
-const mongoose = require('mongoose');
-
 const { getInstance } = require('../setup-crowi');
 const { getInstance } = require('../setup-crowi');
 
 
 describe('Config model test', () => {
 describe('Config model test', () => {
   // eslint-disable-next-line no-unused-vars
   // eslint-disable-next-line no-unused-vars
   let crowi;
   let crowi;
-  let Config;
 
 
   beforeAll(async(done) => {
   beforeAll(async(done) => {
     crowi = await getInstance();
     crowi = await getInstance();
     done();
     done();
   });
   });
 
 
-  beforeEach(async(done) => {
-    Config = mongoose.model('Config');
-    done();
-  });
-
   describe('.CONSTANTS', () => {
   describe('.CONSTANTS', () => {
-    test('Config has constants', async() => {
-      expect(Config.SECURITY_REGISTRATION_MODE_OPEN).toBe('Open');
-      expect(Config.SECURITY_REGISTRATION_MODE_RESTRICTED).toBe('Resricted');
-      expect(Config.SECURITY_REGISTRATION_MODE_CLOSED).toBe('Closed');
+    test('AclService has constants', async() => {
+      expect(crowi.aclService.labels.SECURITY_REGISTRATION_MODE_OPEN).toBe('Open');
+      expect(crowi.aclService.labels.SECURITY_REGISTRATION_MODE_RESTRICTED).toBe('Resricted');
+      expect(crowi.aclService.labels.SECURITY_REGISTRATION_MODE_CLOSED).toBe('Closed');
     });
     });
   });
   });