From d0cbb133ca06ce3b84e1e68696862866ab8602ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20A=CC=8Ahsberg?= Date: Thu, 25 Mar 2021 14:05:00 +0000 Subject: [PATCH] Fix failing tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathias Åhsberg --- .../src/ingestion/processors/ldap/read.test.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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 () => {