mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-18 14:08:21 +00:00
* refactor: Derive a Send's Code Decision Inside @librechat/chat TurnServices.resolveCode computed the code workspace and approval a send carries in the app. It becomes readCodeInputs, a storage read of the raw values, and the package derives the decision through resolveTurnCode. The read goes through a ref updated each render, so a captured adapter still reads the newest render's values. * test: Close Mocked Readers Over Each Render in the Freshness Spec * test: Close the Mobile Drawer Through the Race-Tolerant Helper in Two Agent Specs Two specs closed the drawer after selecting an agent with a bare click on Close sidebar. The drawer closes itself as the selection lands, so the click waited on a button that stopped being visible and ran into the 120 s test timeout on phones. closeMobileDrawer, which #17764 added for this, handles that race and keeps the inert check.
28 lines
980 B
TypeScript
28 lines
980 B
TypeScript
import type { TurnServices } from '@librechat/chat/react';
|
|
|
|
/** Turn services with no app behind them, for specs that mock `~/hooks/Chat/services` because
|
|
* they exercise the chat hooks without a router, query client or agent settings. */
|
|
export const createTestTurnServices = (): TurnServices => ({
|
|
logger: { log: jest.fn(), dir: jest.fn(), warn: jest.fn() },
|
|
isTemporary: false,
|
|
getEndpointsConfig: () => undefined,
|
|
getEphemeralAgent: () => null,
|
|
getUserKey: () => undefined,
|
|
getRouteProjectId: () => null,
|
|
readCodeInputs: () => ({
|
|
workspace: {
|
|
conversation: null,
|
|
canRunCode: false,
|
|
configurationLoaded: true,
|
|
recoveryPending: true,
|
|
replacingDecision: false,
|
|
statuses: {},
|
|
getPreferredWorkspace: () => undefined,
|
|
},
|
|
approval: { conversation: null, reachable: { agents: [], complete: true } },
|
|
latest: null,
|
|
}),
|
|
openNewChat: jest.fn(),
|
|
releaseFiles: jest.fn(),
|
|
clearFilesToDelete: jest.fn(),
|
|
});
|