mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-23 03:40:14 +01:00
refactor(db): replace connectDb import paths and introduce new connect module
- Updated import paths for connectDb across various files to use the new centralized connect module. - Removed the old connectDb file to streamline the database connection logic. - Ensured all tests and models reference the new connection method for consistency.
This commit is contained in:
parent
7cf3f98475
commit
eb368fcb70
17 changed files with 36 additions and 42 deletions
|
|
@ -13,12 +13,10 @@ const mockPluginService = {
|
|||
const mockModels = {
|
||||
User: mockUser,
|
||||
};
|
||||
jest.mock('~/lib/db/connectDb', () => {
|
||||
jest.mock('~/db/connect', () => {
|
||||
return {
|
||||
connectDb: jest.fn(),
|
||||
get models() {
|
||||
return mockModels;
|
||||
},
|
||||
User: mockModels.mockUser,
|
||||
};
|
||||
});
|
||||
jest.mock('~/models/File', () => ({
|
||||
|
|
@ -60,7 +58,7 @@ describe('Tool Handlers', () => {
|
|||
},
|
||||
);
|
||||
|
||||
fakeUser = await User.createUser({
|
||||
fakeUser = await mockModels.User.createUser({
|
||||
name: 'Fake User',
|
||||
username: 'fakeuser',
|
||||
email: 'fakeuser@example.com',
|
||||
|
|
@ -226,7 +224,6 @@ describe('Tool Handlers', () => {
|
|||
try {
|
||||
await loadTool2();
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect(error).toBeDefined();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue