|
@@ -23,6 +23,13 @@ describe('LdapUserGroupSyncService.generateExternalUserGroupTrees', () => {
|
|
|
const mockBind = jest.spyOn(LdapService.prototype, 'bind');
|
|
const mockBind = jest.spyOn(LdapService.prototype, 'bind');
|
|
|
const mockLdapSearch = jest.spyOn(LdapService.prototype, 'search');
|
|
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() => {
|
|
beforeAll(async() => {
|
|
|
crowi = await getInstance();
|
|
crowi = await getInstance();
|
|
|
await configManager.updateConfigsInTheSameNamespace('crowi', configParams, true);
|
|
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', () => {
|
|
describe('When there is no circular reference in group tree', () => {
|
|
|
it('creates ExternalUserGroupTrees', async() => {
|
|
it('creates ExternalUserGroupTrees', async() => {
|
|
|
// mock search on LDAP server
|
|
// mock search on LDAP server
|