Skip to content

Commit 8a5b49c

Browse files
committed
Fix test
1 parent b3d2b47 commit 8a5b49c

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

packages/server/api/test/unit/mcp/llm-query-router.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jest.mock('ai', () => ({
2323
jest.mock('@openops/common', () => ({
2424
isLLMTelemetryEnabled: jest.fn().mockReturnValue(false),
2525
getTableNames: jest.fn().mockResolvedValue(['table1', 'table2', 'table3']),
26+
getDatabaseTableNames: jest
27+
.fn()
28+
.mockResolvedValue(['table1', 'table2', 'table3']),
2629
}));
2730

2831
jest.mock('@openops/server-shared', () => ({
@@ -34,12 +37,25 @@ jest.mock('@openops/server-shared', () => ({
3437
get: jest.fn().mockReturnValue('mock-value'),
3538
getBoolean: jest.fn().mockReturnValue(false),
3639
},
40+
AppSystemProp: {
41+
DB_TYPE: 'DB_TYPE',
42+
USE_DATABASE_TOKEN: 'USE_DATABASE_TOKEN',
43+
},
3744
}));
3845

3946
jest.mock('../../../src/app/ai/chat/ai-chat.service', () => ({
4047
getChatTools: jest.fn(),
4148
}));
4249

50+
jest.mock('../../../src/app/project/project-service', () => ({
51+
projectService: {
52+
getOneOrThrow: jest.fn().mockResolvedValue({
53+
tablesDatabaseId: 1,
54+
tablesDatabaseToken: 'mock-encrypted-token',
55+
}),
56+
},
57+
}));
58+
4359
const getChatToolsMock = getChatTools as jest.Mock;
4460

4561
describe('selectToolsAndQuery', () => {

0 commit comments

Comments
 (0)