From 5cc74e3870e037858331c69663b05f3dbad99a2b Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Sat, 18 Apr 2026 10:59:16 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20fix:=20use=20ServerRequest=20in?= =?UTF-8?q?=20discovery=20spec=20helpers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI `tsc --noEmit -p packages/api/tsconfig.json` caught that the test helpers typed `req` as `express.Request`, which is not assignable to `DiscoverConnectedAgentsParams.req` (typed as `ServerRequest` whose `user` is `IUser`). Local jest passed because ts-jest is transpile-only, but the CI typecheck uses the full compiler. --- packages/api/src/agents/discovery.spec.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/api/src/agents/discovery.spec.ts b/packages/api/src/agents/discovery.spec.ts index 43424e07a2..337f9bd059 100644 --- a/packages/api/src/agents/discovery.spec.ts +++ b/packages/api/src/agents/discovery.spec.ts @@ -1,5 +1,6 @@ import type { Agent, GraphEdge } from 'librechat-data-provider'; -import type { Request, Response } from 'express'; +import type { Response } from 'express'; +import type { ServerRequest } from '~/types'; import type { InitializedAgent } from './initialize'; jest.mock('@librechat/data-schemas', () => ({ @@ -23,10 +24,10 @@ jest.mock('./validation', () => ({ import { discoverConnectedAgents } from './discovery'; -const makeReq = (userId = 'u1', role = 'USER'): Request => +const makeReq = (userId = 'u1', role = 'USER'): ServerRequest => ({ user: { id: userId, role }, - }) as unknown as Request; + }) as unknown as ServerRequest; const makeRes = (): Response => ({}) as unknown as Response; @@ -352,7 +353,7 @@ describe('discoverConnectedAgents', () => { const result = await discoverConnectedAgents( { - req: { user: undefined } as unknown as Request, + req: { user: undefined } as unknown as ServerRequest, res: makeRes(), primaryConfig, allowedProviders: new Set(),