LibreChat/api/models/index.spec.js
Dustin Healy 7dd4fafdf3
📬 feat: Persist Channel Events and Delivery Receipts (#17595)
* 📬 feat: Persist Channel Events and Delivery Receipts

* fix: enforce channel run identity and fenced recovery

* fix: fence and erase channel state during account deletion

* refactor: share channel owner admission with private persistence

* refactor: name channel account-erasure boundary explicitly

* fix: prove channel identity and delivery authority at storage boundaries

* refactor: enforce channel delivery protocol and terminal lifecycle

* fix: enforce channel tenant and operation boundaries

* fix: initialize channel config from its composition owner

* test: verify config installs channel storage reader

* test: complete config initializer contract in model mocks

* test: include channel config reader in migration fixture

* test: await SSE subscription before advancing keepalive time

* test: Observe and Drain Concurrent Fixture Work
2026-11-10 21:03:57 -08:00

36 lines
1.7 KiB
JavaScript

jest.mock('@librechat/data-schemas', () => ({ createMethods: jest.fn(() => ({})) }));
jest.mock('@librechat/api', () => ({
matchModelName: jest.fn(),
findMatchingPattern: jest.fn(),
isDeploymentSkillId: jest.fn(),
createChannelStorageConfigReader: jest.fn(() => ({
getConfig: jest.fn(),
initialize: 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, createChannelStorageConfigReader } = require('@librechat/api');
const { initializeMessageBudget, initializeChannelStorageConfig } = require('./index');
const reader = createMessageBudgetReader.mock.results[0].value;
const channelStorageConfigReader = createChannelStorageConfigReader.mock.results[0].value;
const { getMCPAppMessageBudget, getChannelStorageConfig: channelStorageConfigDependency } =
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();
});
});
describe('channel storage configuration dependency wiring', () => {
it('injects the deployment reader without reading config during module initialization', () => {
expect(channelStorageConfigDependency).toBe(channelStorageConfigReader.getConfig);
expect(initializeChannelStorageConfig).toBe(channelStorageConfigReader.initialize);
expect(channelStorageConfigReader.getConfig).not.toHaveBeenCalled();
});
});