Futa Arai 2 лет назад
Родитель
Сommit
74daf528bb
1 измененных файлов с 7 добавлено и 4 удалено
  1. 7 4
      apps/app/test/integration/service/ldap-user-group-sync.test.ts

+ 7 - 4
apps/app/test/integration/service/ldap-user-group-sync.test.ts

@@ -23,6 +23,13 @@ describe('LdapUserGroupSyncService.generateExternalUserGroupTrees', () => {
   const mockBind = jest.spyOn(LdapService.prototype, 'bind');
   const mockLdapSearch = jest.spyOn(LdapService.prototype, 'search');
 
+  // mock LdapService constructor
+  const OriginalLdapService = { ...LdapService };
+  const mockConstructor = jest.fn(function(username, password) {
+    OriginalLdapService.constructor.call(this, 'Mocked LdapServer');
+  });
+  LdapService.prototype.constructor = mockConstructor;
+
   beforeAll(async() => {
     crowi = await getInstance();
     await configManager.updateConfigsInTheSameNamespace('crowi', configParams, true);
@@ -35,10 +42,6 @@ describe('LdapUserGroupSyncService.generateExternalUserGroupTrees', () => {
     });
   });
 
-  afterAll(async() => {
-    await configManager.updateConfigsInTheSameNamespace('crowi', { 'security:passport-ldap:serverUrl': undefined }, true);
-  });
-
   describe('When there is no circular reference in group tree', () => {
     it('creates ExternalUserGroupTrees', async() => {
       // mock search on LDAP server