LibreChat/api/models/index.spec.js
lia-by-librechat[bot] 55f3187296 🥢 fix: Fit MCP App Snapshots Within Message Documents (#16299)
* 🥢 fix: Fit MCP App Snapshots Within Message Documents

* 🥢 fix: Resolve Message Model Only at App Write Time

* 🥢 style: Sort MCP App Snapshot Persistence Imports

* 🥢 fix: Centralize MCP App Message Admission Across Writers

* 🥢 fix: Inject the App Budget Reader Without a Config Cycle

* test: Cover App Budget Initialization Across Mocked Hosts

---------

Co-authored-by: Lia <lia@librechat.ai>
(cherry picked from commit 411bb5444f)

Original-PR: https://github.com/LibreChat-AI/LibreChat/pull/16299
2026-10-01 03:46:17 +00:00

22 lines
1,018 B
JavaScript

jest.mock('@librechat/data-schemas', () => ({ createMethods: jest.fn(() => ({})) }));
jest.mock('@librechat/api', () => ({
matchModelName: jest.fn(),
findMatchingPattern: jest.fn(),
isDeploymentSkillId: jest.fn(),
createMessageBudgetReader: jest.fn(() => ({ getBudget: jest.fn(), initialize: jest.fn() })),
}));
jest.mock('~/cache/getLogStores', () => jest.fn());
const { createMethods } = require('@librechat/data-schemas');
const { createMessageBudgetReader } = require('@librechat/api');
const { initializeMessageBudget } = require('./index');
const reader = createMessageBudgetReader.mock.results[0].value;
const { getMCPAppMessageBudget } = createMethods.mock.calls[0][1];
describe('message App budget dependency wiring', () => {
it('passes the same reader to storage and initializer to the composition root', () => {
expect(getMCPAppMessageBudget).toBe(reader.getBudget);
expect(initializeMessageBudget).toBe(reader.initialize);
expect(reader.getBudget).not.toHaveBeenCalled();
});
});