diff --git a/plugins/catalog-backend/src/ingestion/processors/ldap/read.test.ts b/plugins/catalog-backend/src/ingestion/processors/ldap/read.test.ts index 4155c2124e..76dc9de0f6 100644 --- a/plugins/catalog-backend/src/ingestion/processors/ldap/read.test.ts +++ b/plugins/catalog-backend/src/ingestion/processors/ldap/read.test.ts @@ -26,6 +26,7 @@ import { LDAP_UUID_ANNOTATION, } from './constants'; import { readLdapGroups, readLdapUsers, resolveRelations } from './read'; +import { DefaultLdapVendor } from './vendors'; function user(data: RecursivePartial): UserEntity { return merge( @@ -55,20 +56,21 @@ function group(data: RecursivePartial): GroupEntity { function searchEntry(attributes: Record): SearchEntry { return { - attributes: Object.entries(attributes).map(([k, vs]) => ({ - json: { - type: k, - vals: vs, - }, - })), + raw: Object.entries(attributes).reduce((obj, [key, values]) => { + obj[key] = values; + return obj; + }, {} as any), } as any; } describe('readLdapUsers', () => { const client: jest.Mocked = { search: jest.fn(), + getVendor: jest.fn(), } as any; + beforeEach(() => client.getVendor.mockResolvedValue(DefaultLdapVendor)); + afterEach(() => jest.resetAllMocks()); it('transfers all attributes', async () => { @@ -128,8 +130,11 @@ describe('readLdapUsers', () => { describe('readLdapGroups', () => { const client: jest.Mocked = { search: jest.fn(), + getVendor: jest.fn(), } as any; + beforeEach(() => client.getVendor.mockResolvedValue(DefaultLdapVendor)); + afterEach(() => jest.resetAllMocks()); it('transfers all attributes', async () => {