mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-07-04 21:32:10 +00:00
🧪 test: reconcile specs + lint with dev after rebase
- guard optional primeResources attachments (result.attachments?.map) - revert 4 attachments assertions toEqual([]) -> toBeUndefined() to match dev's empty/no-attachments return contract (the PR's earlier toEqual([]) change predated dev returning undefined for those paths) - drop unused TDefaultLLMDeliveryPathConfig import in file-config.spec.ts - prettier formatting in resolve-llm-delivery-path.spec.ts
This commit is contained in:
parent
602de762b9
commit
0edd20fc38
3 changed files with 18 additions and 12 deletions
|
|
@ -115,7 +115,7 @@ describe('primeResources', () => {
|
|||
});
|
||||
|
||||
expect(mockGetFiles).not.toHaveBeenCalled();
|
||||
expect(result.attachments).toEqual([]);
|
||||
expect(result.attachments).toBeUndefined();
|
||||
expect(result.tool_resources).toEqual(tool_resources);
|
||||
});
|
||||
});
|
||||
|
|
@ -1347,7 +1347,7 @@ describe('primeResources', () => {
|
|||
role: 'USER',
|
||||
agentId: 'agent_shared',
|
||||
});
|
||||
expect(result.attachments).toEqual([]);
|
||||
expect(result.attachments).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should skip filtering when filterFiles is not provided', async () => {
|
||||
|
|
@ -1515,8 +1515,8 @@ describe('primeResources', () => {
|
|||
|
||||
expect(mockGetFiles).not.toHaveBeenCalled();
|
||||
// When appConfig agents endpoint is missing, context is disabled
|
||||
// and no attachments are provided, the function returns an empty array
|
||||
expect(result.attachments).toEqual([]);
|
||||
// and no attachments are provided, the function returns undefined
|
||||
expect(result.attachments).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should handle undefined tool_resources', async () => {
|
||||
|
|
@ -1530,7 +1530,7 @@ describe('primeResources', () => {
|
|||
});
|
||||
|
||||
expect(result.tool_resources).toEqual({});
|
||||
expect(result.attachments).toEqual([]);
|
||||
expect(result.attachments).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should handle empty requestFileSet', async () => {
|
||||
|
|
@ -1609,7 +1609,7 @@ describe('primeResources', () => {
|
|||
agentId: 'agent1',
|
||||
});
|
||||
|
||||
const attachmentIds = result.attachments.map((f) => f?.file_id);
|
||||
const attachmentIds = result.attachments?.map((f) => f?.file_id);
|
||||
expect(attachmentIds).toContain('provider-file');
|
||||
expect(attachmentIds).toContain('none-file');
|
||||
});
|
||||
|
|
@ -1642,7 +1642,7 @@ describe('primeResources', () => {
|
|||
loadCodeApiKey: jest.fn().mockResolvedValue('code-key'),
|
||||
});
|
||||
|
||||
expect(result.attachments.map((f) => f?.file_id)).toContain('none-file');
|
||||
expect(result.attachments?.map((f) => f?.file_id)).toContain('none-file');
|
||||
expect(result.provisionState?.codeEnvFiles.map((f) => f.file_id)).toContain('none-file');
|
||||
expect(result.provisionState?.vectorDBFiles.map((f) => f.file_id)).toContain('none-file');
|
||||
});
|
||||
|
|
@ -1672,7 +1672,7 @@ describe('primeResources', () => {
|
|||
agentId: 'agent1',
|
||||
});
|
||||
|
||||
const attachmentIds = result.attachments.map((f) => f?.file_id);
|
||||
const attachmentIds = result.attachments?.map((f) => f?.file_id);
|
||||
expect(attachmentIds).toContain('legacy-file');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import type { TDefaultLLMDeliveryPathConfig } from './file-config';
|
||||
import type { FileConfig } from './types/files';
|
||||
import {
|
||||
fileConfig as baseFileConfig,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
import { resolveDefaultLLMDeliveryPath, SYSTEM_LLM_DELIVERY_DEFAULTS } from './resolve-llm-delivery-path';
|
||||
import {
|
||||
resolveDefaultLLMDeliveryPath,
|
||||
SYSTEM_LLM_DELIVERY_DEFAULTS,
|
||||
} from './resolve-llm-delivery-path';
|
||||
import type { TDefaultLLMDeliveryPathConfig } from './file-config';
|
||||
|
||||
describe('resolveDefaultLLMDeliveryPath', () => {
|
||||
|
|
@ -69,8 +72,12 @@ describe('resolveDefaultLLMDeliveryPath', () => {
|
|||
it('should fall through entire chain to system defaults', () => {
|
||||
const endpointConfig: TDefaultLLMDeliveryPathConfig = {};
|
||||
const globalConfig: TDefaultLLMDeliveryPathConfig = {};
|
||||
expect(resolveDefaultLLMDeliveryPath('image/png', endpointConfig, globalConfig)).toBe('provider');
|
||||
expect(resolveDefaultLLMDeliveryPath('application/pdf', endpointConfig, globalConfig)).toBe('provider');
|
||||
expect(resolveDefaultLLMDeliveryPath('image/png', endpointConfig, globalConfig)).toBe(
|
||||
'provider',
|
||||
);
|
||||
expect(resolveDefaultLLMDeliveryPath('application/pdf', endpointConfig, globalConfig)).toBe(
|
||||
'provider',
|
||||
);
|
||||
expect(resolveDefaultLLMDeliveryPath('text/csv', endpointConfig, globalConfig)).toBe('text');
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue