mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 08:12:00 +02:00

* Disable default static caching for app's index page * Update index.html related environment variables in `.env.example` * Fix linting * Update index.spec.js --------- Co-authored-by: Danny Avila <danacordially@gmail.com>
63 lines
1.5 KiB
JavaScript
63 lines
1.5 KiB
JavaScript
jest.mock('winston', () => {
|
|
const mockFormatFunction = jest.fn((fn) => fn);
|
|
|
|
mockFormatFunction.colorize = jest.fn();
|
|
mockFormatFunction.combine = jest.fn();
|
|
mockFormatFunction.label = jest.fn();
|
|
mockFormatFunction.timestamp = jest.fn();
|
|
mockFormatFunction.printf = jest.fn();
|
|
mockFormatFunction.errors = jest.fn();
|
|
mockFormatFunction.splat = jest.fn();
|
|
mockFormatFunction.json = jest.fn();
|
|
return {
|
|
format: mockFormatFunction,
|
|
createLogger: jest.fn().mockReturnValue({
|
|
info: jest.fn(),
|
|
warn: jest.fn(),
|
|
debug: jest.fn(),
|
|
error: jest.fn(),
|
|
}),
|
|
transports: {
|
|
Console: jest.fn(),
|
|
DailyRotateFile: jest.fn(),
|
|
File: jest.fn(),
|
|
},
|
|
addColors: jest.fn(),
|
|
};
|
|
});
|
|
|
|
jest.mock('winston-daily-rotate-file', () => {
|
|
return jest.fn().mockImplementation(() => {
|
|
return {
|
|
level: 'error',
|
|
filename: '../logs/error-%DATE%.log',
|
|
datePattern: 'YYYY-MM-DD',
|
|
zippedArchive: true,
|
|
maxSize: '20m',
|
|
maxFiles: '14d',
|
|
format: 'format',
|
|
};
|
|
});
|
|
});
|
|
|
|
jest.mock('~/config', () => {
|
|
const actualModule = jest.requireActual('~/config');
|
|
return {
|
|
sendEvent: actualModule.sendEvent,
|
|
createAxiosInstance: actualModule.createAxiosInstance,
|
|
logger: {
|
|
info: jest.fn(),
|
|
warn: jest.fn(),
|
|
debug: jest.fn(),
|
|
error: jest.fn(),
|
|
},
|
|
};
|
|
});
|
|
|
|
jest.mock('~/config/parsers', () => {
|
|
return {
|
|
redactMessage: jest.fn(),
|
|
redactFormat: jest.fn(),
|
|
debugTraverse: jest.fn(),
|
|
};
|
|
});
|