mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-22 19:30:15 +01:00
ci: Integrate getAppConfig into remaining tests
This commit is contained in:
parent
5b43bf6c95
commit
5bb731764c
6 changed files with 164 additions and 84 deletions
|
|
@ -1,9 +1,11 @@
|
|||
const { fetchModels } = require('~/server/services/ModelService');
|
||||
const { getCustomConfig } = require('./getCustomConfig');
|
||||
const { getAppConfig } = require('./getAppConfig');
|
||||
const loadConfigModels = require('./loadConfigModels');
|
||||
|
||||
jest.mock('~/server/services/ModelService');
|
||||
jest.mock('./getCustomConfig');
|
||||
jest.mock('./getAppConfig');
|
||||
|
||||
const exampleConfig = {
|
||||
endpoints: {
|
||||
|
|
@ -60,7 +62,7 @@ const exampleConfig = {
|
|||
};
|
||||
|
||||
describe('loadConfigModels', () => {
|
||||
const mockRequest = { app: { locals: {} }, user: { id: 'testUserId' } };
|
||||
const mockRequest = { user: { id: 'testUserId' } };
|
||||
|
||||
const originalEnv = process.env;
|
||||
|
||||
|
|
@ -68,6 +70,9 @@ describe('loadConfigModels', () => {
|
|||
jest.resetAllMocks();
|
||||
jest.resetModules();
|
||||
process.env = { ...originalEnv };
|
||||
|
||||
// Default mock for getAppConfig
|
||||
getAppConfig.mockResolvedValue({});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
|
@ -81,7 +86,9 @@ describe('loadConfigModels', () => {
|
|||
});
|
||||
|
||||
it('handles azure models and endpoint correctly', async () => {
|
||||
mockRequest.app.locals.azureOpenAI = { modelNames: ['model1', 'model2'] };
|
||||
getAppConfig.mockResolvedValue({
|
||||
azureOpenAI: { modelNames: ['model1', 'model2'] },
|
||||
});
|
||||
getCustomConfig.mockResolvedValue({
|
||||
endpoints: {
|
||||
azureOpenAI: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue