mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-10-22 10:02:41 +00:00
🧪 fix: use ServerRequest in discovery spec helpers
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.
This commit is contained in:
parent
e9e435b796
commit
5cc74e3870
1 changed files with 5 additions and 4 deletions
|
|
@ -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(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue