@app-connect/core 1.7.36 → 1.7.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -16
- package/dist/connector/developerPortal.d.ts +6 -0
- package/{connector → dist/connector}/developerPortal.js +29 -12
- package/dist/connector/mock.d.ts +1 -0
- package/{connector → dist/connector}/mock.js +33 -17
- package/dist/connector/proxy/engine.d.ts +10 -0
- package/dist/connector/proxy/engine.js +222 -0
- package/dist/connector/proxy/index.d.ts +5 -0
- package/dist/connector/proxy/index.js +511 -0
- package/dist/connector/registry.d.ts +1 -0
- package/dist/connector/registry.js +243 -0
- package/dist/handlers/admin.d.ts +1 -0
- package/{handlers → dist/handlers}/admin.js +137 -78
- package/dist/handlers/appointment.d.ts +9 -0
- package/{handlers → dist/handlers}/appointment.js +58 -29
- package/dist/handlers/auth.d.ts +9 -0
- package/{handlers → dist/handlers}/auth.js +68 -40
- package/dist/handlers/calldown.d.ts +10 -0
- package/dist/handlers/calldown.js +134 -0
- package/dist/handlers/contact.d.ts +1 -0
- package/{handlers → dist/handlers}/contact.js +61 -39
- package/dist/handlers/disposition.d.ts +1 -0
- package/{handlers → dist/handlers}/disposition.js +20 -10
- package/dist/handlers/log.d.ts +1 -0
- package/{handlers → dist/handlers}/log.js +91 -124
- package/dist/handlers/managedAuth.d.ts +1 -0
- package/{handlers → dist/handlers}/managedAuth.js +134 -61
- package/dist/handlers/managedOAuth.d.ts +13 -0
- package/{handlers → dist/handlers}/managedOAuth.js +102 -30
- package/dist/handlers/plugin.d.ts +1 -0
- package/{handlers → dist/handlers}/plugin.js +59 -27
- package/dist/handlers/user.d.ts +1 -0
- package/{handlers → dist/handlers}/user.js +45 -27
- package/dist/index.d.ts +1 -0
- package/{index.js → dist/index.js} +548 -450
- package/dist/jest.config.d.ts +1 -0
- package/dist/jest.config.js +65 -0
- package/dist/lib/analytics.d.ts +4 -0
- package/{lib → dist/lib}/analytics.js +8 -6
- package/dist/lib/authSession.d.ts +5 -0
- package/{lib → dist/lib}/authSession.js +15 -43
- package/dist/lib/cacheCleanup.d.ts +4 -0
- package/{lib → dist/lib}/cacheCleanup.js +5 -17
- package/dist/lib/callLogComposer.d.ts +109 -0
- package/{lib → dist/lib}/callLogComposer.js +157 -197
- package/dist/lib/callLogLookup.d.ts +6 -0
- package/{lib → dist/lib}/callLogLookup.js +12 -34
- package/dist/lib/constants.d.ts +6 -0
- package/dist/lib/constants.js +9 -0
- package/dist/lib/debugTracer.d.ts +17 -0
- package/{lib → dist/lib}/debugTracer.js +7 -83
- package/dist/lib/encode.d.ts +3 -0
- package/dist/lib/encode.js +50 -0
- package/dist/lib/errorHandler.d.ts +7 -0
- package/dist/lib/errorHandler.js +161 -0
- package/dist/lib/generalErrorMessage.d.ts +7 -0
- package/{lib → dist/lib}/generalErrorMessage.js +6 -6
- package/dist/lib/jwt.d.ts +4 -0
- package/dist/lib/jwt.js +18 -0
- package/dist/lib/logger.d.ts +24 -0
- package/dist/lib/logger.js +126 -0
- package/dist/lib/migrateCallLogsSchema.d.ts +32 -0
- package/dist/lib/migrateCallLogsSchema.js +339 -0
- package/dist/lib/oauth.d.ts +4 -0
- package/{lib → dist/lib}/oauth.js +157 -160
- package/dist/lib/ringcentral.d.ts +24 -0
- package/dist/lib/ringcentral.js +226 -0
- package/dist/lib/s3ErrorLogReport.d.ts +4 -0
- package/{lib → dist/lib}/s3ErrorLogReport.js +11 -23
- package/dist/lib/sharedSMSComposer.d.ts +7 -0
- package/{lib → dist/lib}/sharedSMSComposer.js +21 -107
- package/dist/lib/util.d.ts +7 -0
- package/{lib → dist/lib}/util.js +9 -20
- package/dist/mcp/lib/oauthError.d.ts +1 -0
- package/dist/mcp/lib/oauthError.js +25 -0
- package/dist/mcp/lib/validator.d.ts +1 -0
- package/{mcp → dist/mcp}/lib/validator.js +16 -20
- package/dist/mcp/lib/widgetSessionToken.d.ts +1 -0
- package/dist/mcp/lib/widgetSessionToken.js +46 -0
- package/dist/mcp/mcpHandler.d.ts +8 -0
- package/{mcp → dist/mcp}/mcpHandler.js +98 -88
- package/dist/mcp/tools/cancelAppointment.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/cancelAppointment.js +7 -16
- package/dist/mcp/tools/checkAuthStatus.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/checkAuthStatus.js +21 -14
- package/dist/mcp/tools/confirmAppointment.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/confirmAppointment.js +7 -16
- package/dist/mcp/tools/createAppointment.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/createAppointment.js +7 -19
- package/dist/mcp/tools/createCallLog.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/createCallLog.js +18 -29
- package/dist/mcp/tools/createContact.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/createContact.js +8 -20
- package/dist/mcp/tools/createMessageLog.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/createMessageLog.js +14 -26
- package/dist/mcp/tools/doAuth.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/doAuth.js +17 -13
- package/dist/mcp/tools/findContactByName.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/findContactByName.js +9 -15
- package/dist/mcp/tools/findContactByPhone.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/findContactByPhone.js +8 -15
- package/dist/mcp/tools/getCallLog.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/getCallLog.js +12 -21
- package/dist/mcp/tools/getGoogleFilePicker.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/getGoogleFilePicker.js +9 -18
- package/dist/mcp/tools/getHelp.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/getHelp.js +5 -6
- package/dist/mcp/tools/getPublicConnectors.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/getPublicConnectors.js +19 -18
- package/dist/mcp/tools/getSessionInfo.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/getSessionInfo.js +10 -16
- package/dist/mcp/tools/index.d.ts +8 -0
- package/dist/mcp/tools/index.js +50 -0
- package/dist/mcp/tools/listAppointments.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/listAppointments.js +7 -19
- package/dist/mcp/tools/logout.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/logout.js +16 -14
- package/dist/mcp/tools/rcGetCallLogs.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/rcGetCallLogs.js +10 -8
- package/dist/mcp/tools/updateAppointment.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/updateAppointment.js +17 -22
- package/dist/mcp/tools/updateCallLog.d.ts +1 -0
- package/{mcp → dist/mcp}/tools/updateCallLog.js +16 -26
- package/dist/models/accountDataModel.d.ts +3 -0
- package/dist/models/accountDataModel.js +39 -0
- package/dist/models/adminConfigModel.d.ts +2 -0
- package/dist/models/adminConfigModel.js +39 -0
- package/dist/models/cacheModel.d.ts +2 -0
- package/{models → dist/models}/cacheModel.js +7 -3
- package/dist/models/callDownListModel.d.ts +2 -0
- package/{models → dist/models}/callDownListModel.js +8 -4
- package/dist/models/callLogModel.d.ts +2 -0
- package/dist/models/callLogModel.js +43 -0
- package/dist/models/dynamo/connectorSchema.d.ts +2 -0
- package/dist/models/dynamo/connectorSchema.js +141 -0
- package/dist/models/dynamo/lockSchema.d.ts +2 -0
- package/{models → dist/models}/dynamo/lockSchema.js +5 -7
- package/dist/models/dynamo/noteCacheSchema.d.ts +2 -0
- package/{models → dist/models}/dynamo/noteCacheSchema.js +4 -6
- package/dist/models/llmSessionModel.d.ts +2 -0
- package/dist/models/llmSessionModel.js +21 -0
- package/dist/models/messageLogModel.d.ts +2 -0
- package/{models → dist/models}/messageLogModel.js +8 -4
- package/dist/models/sequelize.d.ts +2 -0
- package/dist/models/sequelize.js +68 -0
- package/dist/models/userModel.d.ts +2 -0
- package/dist/models/userModel.js +49 -0
- package/dist/package.json +100 -0
- package/dist/releaseNotes.json +1222 -0
- package/dist/tsconfig.json +14 -0
- package/dist/types/admin.d.ts +141 -0
- package/dist/types/analytics.d.ts +14 -0
- package/dist/types/appointment.d.ts +50 -0
- package/dist/types/auth.d.ts +137 -0
- package/dist/types/authSession.d.ts +35 -0
- package/dist/types/cacheCleanup.d.ts +12 -0
- package/dist/types/calldown.d.ts +54 -0
- package/dist/types/common.d.ts +46 -0
- package/dist/types/connector.d.ts +165 -0
- package/dist/types/contact.d.ts +125 -0
- package/dist/types/errorHandler.d.ts +60 -0
- package/dist/types/index.d.ts +76 -0
- package/dist/types/json.d.ts +9 -0
- package/dist/types/jwt.d.ts +8 -0
- package/dist/types/logging.d.ts +224 -0
- package/dist/types/managedAuth.d.ts +114 -0
- package/dist/types/managedOAuth.d.ts +59 -0
- package/dist/types/manifest.d.ts +120 -0
- package/dist/types/migration.d.ts +15 -0
- package/dist/types/plugin.d.ts +74 -0
- package/dist/types/ringcentral.d.ts +61 -0
- package/dist/types/s3ErrorLogReport.d.ts +16 -0
- package/dist/types/sharedSMSComposer.d.ts +105 -0
- package/dist/types/user.d.ts +46 -0
- package/dist/types/util.d.ts +7 -0
- package/package.json +34 -6
- package/releaseNotes.json +13 -1
- package/.env.test +0 -5
- package/connector/proxy/engine.js +0 -165
- package/connector/proxy/index.js +0 -500
- package/connector/registry.js +0 -252
- package/docs/README.md +0 -50
- package/docs/architecture.md +0 -94
- package/docs/connectors.md +0 -116
- package/docs/handlers.md +0 -128
- package/docs/libraries.md +0 -98
- package/docs/models.md +0 -146
- package/docs/routes.md +0 -119
- package/docs/tests.md +0 -73
- package/handlers/calldown.js +0 -99
- package/jest.config.js +0 -57
- package/lib/constants.js +0 -9
- package/lib/encode.js +0 -30
- package/lib/errorHandler.js +0 -218
- package/lib/jwt.js +0 -18
- package/lib/logger.js +0 -190
- package/lib/migrateCallLogsSchema.js +0 -237
- package/lib/ringcentral.js +0 -267
- package/mcp/README.md +0 -420
- package/mcp/tools/index.js +0 -51
- package/mcp/ui/App/App.tsx +0 -358
- package/mcp/ui/App/components/AuthInfoForm.tsx +0 -113
- package/mcp/ui/App/components/AuthSuccess.tsx +0 -22
- package/mcp/ui/App/components/ConnectorList.tsx +0 -82
- package/mcp/ui/App/components/DebugPanel.tsx +0 -43
- package/mcp/ui/App/components/OAuthConnect.tsx +0 -270
- package/mcp/ui/App/lib/callTool.ts +0 -130
- package/mcp/ui/App/lib/debugLog.ts +0 -41
- package/mcp/ui/App/lib/developerPortal.ts +0 -111
- package/mcp/ui/App/main.css +0 -6
- package/mcp/ui/App/root.tsx +0 -13
- package/mcp/ui/dist/index.html +0 -53
- package/mcp/ui/vite.config.ts +0 -16
- package/models/accountDataModel.js +0 -34
- package/models/adminConfigModel.js +0 -35
- package/models/callLogModel.js +0 -39
- package/models/dynamo/connectorSchema.js +0 -146
- package/models/llmSessionModel.js +0 -17
- package/models/sequelize.js +0 -17
- package/models/userModel.js +0 -45
- package/test/connector/developerPortal.test.js +0 -166
- package/test/connector/mock.test.js +0 -131
- package/test/connector/proxy/engine.test.js +0 -211
- package/test/connector/proxy/index.test.js +0 -525
- package/test/connector/proxy/sample.json +0 -162
- package/test/connector/registry.test.js +0 -416
- package/test/handlers/admin.test.js +0 -960
- package/test/handlers/appointment.test.js +0 -260
- package/test/handlers/auth.test.js +0 -1096
- package/test/handlers/calldown.test.js +0 -310
- package/test/handlers/contact.test.js +0 -1014
- package/test/handlers/disposition.test.js +0 -396
- package/test/handlers/log.test.js +0 -1847
- package/test/handlers/managedAuth.test.js +0 -458
- package/test/handlers/managedOAuth.test.js +0 -262
- package/test/handlers/plugin.test.js +0 -429
- package/test/handlers/user.test.js +0 -381
- package/test/index.test.js +0 -301
- package/test/lib/analytics.test.js +0 -146
- package/test/lib/authSession.test.js +0 -173
- package/test/lib/cacheCleanup.test.js +0 -127
- package/test/lib/callLogComposer.test.js +0 -1231
- package/test/lib/debugTracer.test.js +0 -328
- package/test/lib/encode.test.js +0 -59
- package/test/lib/errorHandler.test.js +0 -246
- package/test/lib/generalErrorMessage.test.js +0 -82
- package/test/lib/jwt.test.js +0 -176
- package/test/lib/logger.test.js +0 -206
- package/test/lib/oauth.test.js +0 -359
- package/test/lib/ringcentral.test.js +0 -467
- package/test/lib/s3ErrorLogReport.test.js +0 -187
- package/test/lib/sharedSMSComposer.test.js +0 -1084
- package/test/lib/util.test.js +0 -329
- package/test/mcp/mcpHandler.test.js +0 -73
- package/test/mcp/mcpHandlerMore.test.js +0 -384
- package/test/mcp/tools/appointmentTools.test.js +0 -362
- package/test/mcp/tools/checkAuthStatus.test.js +0 -83
- package/test/mcp/tools/createCallLog.test.js +0 -436
- package/test/mcp/tools/createContact.test.js +0 -58
- package/test/mcp/tools/createMessageLog.test.js +0 -595
- package/test/mcp/tools/doAuth.test.js +0 -113
- package/test/mcp/tools/findContactByName.test.js +0 -275
- package/test/mcp/tools/findContactByPhone.test.js +0 -296
- package/test/mcp/tools/getCallLog.test.js +0 -298
- package/test/mcp/tools/getGoogleFilePicker.test.js +0 -281
- package/test/mcp/tools/getPublicConnectors.test.js +0 -107
- package/test/mcp/tools/getSessionInfo.test.js +0 -127
- package/test/mcp/tools/logout.test.js +0 -233
- package/test/mcp/tools/rcGetCallLogs.test.js +0 -56
- package/test/mcp/tools/updateCallLog.test.js +0 -360
- package/test/models/accountDataModel.test.js +0 -98
- package/test/models/callDownListModel.test.js +0 -125
- package/test/models/dynamo/connectorSchema.test.js +0 -189
- package/test/models/dynamo/lockSchema.test.js +0 -37
- package/test/models/dynamo/noteCacheSchema.test.js +0 -45
- package/test/models/llmSessionModel.test.js +0 -91
- package/test/models/models.test.js +0 -660
- package/test/routes/calldownRoutes.test.js +0 -224
- package/test/routes/coreRouterBroadRoutes.test.js +0 -855
- package/test/routes/dispositionRoutes.test.js +0 -192
- package/test/routes/managedAuthRoutes.test.js +0 -386
- package/test/routes/pluginRoutes.test.js +0 -262
- package/test/setup.js +0 -178
- /package/{mcp → dist/mcp}/ui/index.html +0 -0
- /package/{mcp → dist/mcp}/ui/package-lock.json +0 -0
- /package/{mcp → dist/mcp}/ui/package.json +0 -0
- /package/{mcp → dist/mcp}/ui/tsconfig.json +0 -0
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
const getCallLog = require('../../../mcp/tools/getCallLog');
|
|
2
|
-
const jwt = require('../../../lib/jwt');
|
|
3
|
-
const connectorRegistry = require('../../../connector/registry');
|
|
4
|
-
const logCore = require('../../../handlers/log');
|
|
5
|
-
|
|
6
|
-
// Mock dependencies
|
|
7
|
-
jest.mock('../../../lib/jwt');
|
|
8
|
-
jest.mock('../../../connector/registry');
|
|
9
|
-
jest.mock('../../../handlers/log');
|
|
10
|
-
|
|
11
|
-
describe('MCP Tool: getCallLog', () => {
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
jest.clearAllMocks();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
describe('tool definition', () => {
|
|
17
|
-
test('should have correct tool definition', () => {
|
|
18
|
-
expect(getCallLog.definition).toBeDefined();
|
|
19
|
-
expect(getCallLog.definition.name).toBe('getCallLog');
|
|
20
|
-
expect(getCallLog.definition.description).toContain('REQUIRES AUTHENTICATION');
|
|
21
|
-
expect(getCallLog.definition.inputSchema).toBeDefined();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
test('should require jwtToken and sessionIds parameters', () => {
|
|
25
|
-
expect(getCallLog.definition.inputSchema.required).toContain('jwtToken');
|
|
26
|
-
expect(getCallLog.definition.inputSchema.required).toContain('sessionIds');
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
test('should have requireDetails optional parameter', () => {
|
|
30
|
-
expect(getCallLog.definition.inputSchema.properties).toHaveProperty('requireDetails');
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
describe('execute', () => {
|
|
35
|
-
test('should get call log successfully', async () => {
|
|
36
|
-
// Arrange
|
|
37
|
-
const mockLogs = [
|
|
38
|
-
{
|
|
39
|
-
id: 'log-123',
|
|
40
|
-
sessionId: 'session-123',
|
|
41
|
-
contactId: 'contact-123',
|
|
42
|
-
phoneNumber: '+1234567890',
|
|
43
|
-
callDirection: 'Inbound',
|
|
44
|
-
callDuration: 120
|
|
45
|
-
}
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
jwt.decodeJwt.mockReturnValue({
|
|
49
|
-
id: 'user-123',
|
|
50
|
-
platform: 'testCRM'
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
const mockConnector = {
|
|
54
|
-
getCallLog: jest.fn()
|
|
55
|
-
};
|
|
56
|
-
connectorRegistry.getConnector.mockReturnValue(mockConnector);
|
|
57
|
-
|
|
58
|
-
logCore.getCallLog.mockResolvedValue({
|
|
59
|
-
successful: true,
|
|
60
|
-
logs: mockLogs,
|
|
61
|
-
returnMessage: { message: 'Logs retrieved' }
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// Act
|
|
65
|
-
const result = await getCallLog.execute({
|
|
66
|
-
jwtToken: 'mock-jwt-token',
|
|
67
|
-
sessionIds: 'session-123'
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
// Assert
|
|
71
|
-
expect(result).toEqual({
|
|
72
|
-
success: true,
|
|
73
|
-
data: mockLogs
|
|
74
|
-
});
|
|
75
|
-
expect(jwt.decodeJwt).toHaveBeenCalledWith('mock-jwt-token');
|
|
76
|
-
expect(connectorRegistry.getConnector).toHaveBeenCalledWith('testCRM');
|
|
77
|
-
expect(logCore.getCallLog).toHaveBeenCalledWith({
|
|
78
|
-
userId: 'user-123',
|
|
79
|
-
sessionIds: 'session-123',
|
|
80
|
-
platform: 'testCRM',
|
|
81
|
-
requireDetails: false
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
test('should get call logs with multiple session IDs', async () => {
|
|
86
|
-
// Arrange
|
|
87
|
-
const mockLogs = [
|
|
88
|
-
{ sessionId: 'session-123', contactId: 'contact-123' },
|
|
89
|
-
{ sessionId: 'session-456', contactId: 'contact-456' }
|
|
90
|
-
];
|
|
91
|
-
|
|
92
|
-
jwt.decodeJwt.mockReturnValue({
|
|
93
|
-
id: 'user-123',
|
|
94
|
-
platform: 'testCRM'
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
const mockConnector = {
|
|
98
|
-
getCallLog: jest.fn()
|
|
99
|
-
};
|
|
100
|
-
connectorRegistry.getConnector.mockReturnValue(mockConnector);
|
|
101
|
-
|
|
102
|
-
logCore.getCallLog.mockResolvedValue({
|
|
103
|
-
successful: true,
|
|
104
|
-
logs: mockLogs
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
// Act
|
|
108
|
-
const result = await getCallLog.execute({
|
|
109
|
-
jwtToken: 'mock-jwt-token',
|
|
110
|
-
sessionIds: 'session-123,session-456'
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
// Assert
|
|
114
|
-
expect(result.success).toBe(true);
|
|
115
|
-
expect(result.data).toHaveLength(2);
|
|
116
|
-
expect(logCore.getCallLog).toHaveBeenCalledWith({
|
|
117
|
-
userId: 'user-123',
|
|
118
|
-
sessionIds: 'session-123,session-456',
|
|
119
|
-
platform: 'testCRM',
|
|
120
|
-
requireDetails: false
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
test('should get call logs with detailed information', async () => {
|
|
125
|
-
// Arrange
|
|
126
|
-
const mockLogs = [
|
|
127
|
-
{
|
|
128
|
-
sessionId: 'session-123',
|
|
129
|
-
contactId: 'contact-123',
|
|
130
|
-
detailedInfo: { recording: 'url', transcript: 'text' }
|
|
131
|
-
}
|
|
132
|
-
];
|
|
133
|
-
|
|
134
|
-
jwt.decodeJwt.mockReturnValue({
|
|
135
|
-
id: 'user-123',
|
|
136
|
-
platform: 'testCRM'
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
const mockConnector = {
|
|
140
|
-
getCallLog: jest.fn()
|
|
141
|
-
};
|
|
142
|
-
connectorRegistry.getConnector.mockReturnValue(mockConnector);
|
|
143
|
-
|
|
144
|
-
logCore.getCallLog.mockResolvedValue({
|
|
145
|
-
successful: true,
|
|
146
|
-
logs: mockLogs
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
// Act
|
|
150
|
-
const result = await getCallLog.execute({
|
|
151
|
-
jwtToken: 'mock-jwt-token',
|
|
152
|
-
sessionIds: 'session-123',
|
|
153
|
-
requireDetails: true
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
// Assert
|
|
157
|
-
expect(result.success).toBe(true);
|
|
158
|
-
expect(result.data).toEqual(mockLogs);
|
|
159
|
-
expect(logCore.getCallLog).toHaveBeenCalledWith({
|
|
160
|
-
userId: 'user-123',
|
|
161
|
-
sessionIds: 'session-123',
|
|
162
|
-
platform: 'testCRM',
|
|
163
|
-
requireDetails: true
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
test('should return error when logs not found', async () => {
|
|
168
|
-
// Arrange
|
|
169
|
-
jwt.decodeJwt.mockReturnValue({
|
|
170
|
-
id: 'user-123',
|
|
171
|
-
platform: 'testCRM'
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
const mockConnector = {
|
|
175
|
-
getCallLog: jest.fn()
|
|
176
|
-
};
|
|
177
|
-
connectorRegistry.getConnector.mockReturnValue(mockConnector);
|
|
178
|
-
|
|
179
|
-
logCore.getCallLog.mockResolvedValue({
|
|
180
|
-
successful: false,
|
|
181
|
-
logs: [],
|
|
182
|
-
returnMessage: { message: 'Logs not found' }
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
// Act
|
|
186
|
-
const result = await getCallLog.execute({
|
|
187
|
-
jwtToken: 'mock-jwt-token',
|
|
188
|
-
sessionIds: 'non-existent-session'
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
// Assert
|
|
192
|
-
expect(result).toEqual({
|
|
193
|
-
success: false,
|
|
194
|
-
error: 'Logs not found'
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
test('should return error when JWT is invalid', async () => {
|
|
199
|
-
// Arrange
|
|
200
|
-
jwt.decodeJwt.mockReturnValue({
|
|
201
|
-
platform: 'testCRM'
|
|
202
|
-
// id is missing
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
// Act
|
|
206
|
-
const result = await getCallLog.execute({
|
|
207
|
-
jwtToken: 'invalid-token',
|
|
208
|
-
sessionIds: 'session-123'
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
// Assert
|
|
212
|
-
expect(result.success).toBe(false);
|
|
213
|
-
expect(result.error).toContain('Invalid JWT token');
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
test('should return error when decodeJwt returns null', async () => {
|
|
217
|
-
jwt.decodeJwt.mockReturnValue(null);
|
|
218
|
-
|
|
219
|
-
const result = await getCallLog.execute({
|
|
220
|
-
jwtToken: 'invalid-token',
|
|
221
|
-
sessionIds: ['session-123']
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
expect(result.success).toBe(false);
|
|
225
|
-
expect(result.error).toContain('Invalid JWT token');
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
test('should return error when platform connector not found', async () => {
|
|
229
|
-
// Arrange
|
|
230
|
-
jwt.decodeJwt.mockReturnValue({
|
|
231
|
-
id: 'user-123',
|
|
232
|
-
platform: 'unknownCRM'
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
connectorRegistry.getConnector.mockReturnValue(null);
|
|
236
|
-
|
|
237
|
-
// Act
|
|
238
|
-
const result = await getCallLog.execute({
|
|
239
|
-
jwtToken: 'mock-jwt-token',
|
|
240
|
-
sessionIds: 'session-123'
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
// Assert
|
|
244
|
-
expect(result.success).toBe(false);
|
|
245
|
-
expect(result.error).toContain('Platform connector not found');
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
test('should return error when getCallLog is not implemented', async () => {
|
|
249
|
-
// Arrange
|
|
250
|
-
jwt.decodeJwt.mockReturnValue({
|
|
251
|
-
id: 'user-123',
|
|
252
|
-
platform: 'testCRM'
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
const mockConnector = {}; // No getCallLog method
|
|
256
|
-
connectorRegistry.getConnector.mockReturnValue(mockConnector);
|
|
257
|
-
|
|
258
|
-
// Act
|
|
259
|
-
const result = await getCallLog.execute({
|
|
260
|
-
jwtToken: 'mock-jwt-token',
|
|
261
|
-
sessionIds: 'session-123'
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
// Assert
|
|
265
|
-
expect(result.success).toBe(false);
|
|
266
|
-
expect(result.error).toContain('not implemented');
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
test('should handle unexpected errors gracefully', async () => {
|
|
270
|
-
// Arrange
|
|
271
|
-
jwt.decodeJwt.mockReturnValue({
|
|
272
|
-
id: 'user-123',
|
|
273
|
-
platform: 'testCRM'
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
const mockConnector = {
|
|
277
|
-
getCallLog: jest.fn()
|
|
278
|
-
};
|
|
279
|
-
connectorRegistry.getConnector.mockReturnValue(mockConnector);
|
|
280
|
-
|
|
281
|
-
logCore.getCallLog.mockRejectedValue(
|
|
282
|
-
new Error('Database query failed')
|
|
283
|
-
);
|
|
284
|
-
|
|
285
|
-
// Act
|
|
286
|
-
const result = await getCallLog.execute({
|
|
287
|
-
jwtToken: 'mock-jwt-token',
|
|
288
|
-
sessionIds: 'session-123'
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
// Assert
|
|
292
|
-
expect(result.success).toBe(false);
|
|
293
|
-
expect(result.error).toBe('Database query failed');
|
|
294
|
-
expect(result.errorDetails).toBeDefined();
|
|
295
|
-
});
|
|
296
|
-
});
|
|
297
|
-
});
|
|
298
|
-
|
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
const getGoogleFilePicker = require('../../../mcp/tools/getGoogleFilePicker');
|
|
2
|
-
const jwt = require('../../../lib/jwt');
|
|
3
|
-
const { UserModel } = require('../../../models/userModel');
|
|
4
|
-
const axios = require('axios');
|
|
5
|
-
|
|
6
|
-
// Mock dependencies
|
|
7
|
-
jest.mock('../../../lib/jwt');
|
|
8
|
-
jest.mock('../../../models/userModel');
|
|
9
|
-
jest.mock('axios');
|
|
10
|
-
|
|
11
|
-
describe('MCP Tool: getGoogleFilePicker', () => {
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
jest.clearAllMocks();
|
|
14
|
-
process.env.APP_SERVER = 'https://test-app-server.com';
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
describe('tool definition', () => {
|
|
18
|
-
test('should have correct tool definition', () => {
|
|
19
|
-
expect(getGoogleFilePicker.definition).toBeDefined();
|
|
20
|
-
expect(getGoogleFilePicker.definition.name).toBe('getGoogleFilePicker');
|
|
21
|
-
expect(getGoogleFilePicker.definition.description).toContain('REQUIRES CRM CONNECTION');
|
|
22
|
-
expect(getGoogleFilePicker.definition.description).toContain('Google Sheets file picker');
|
|
23
|
-
expect(getGoogleFilePicker.definition.inputSchema).toBeDefined();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
test('should not require jwtToken in schema (it is server-injected)', () => {
|
|
27
|
-
expect(getGoogleFilePicker.definition.inputSchema.required).not.toContain('jwtToken');
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('should have optional sheetName parameter', () => {
|
|
31
|
-
expect(getGoogleFilePicker.definition.inputSchema.properties).toHaveProperty('sheetName');
|
|
32
|
-
expect(getGoogleFilePicker.definition.inputSchema.required).not.toContain('sheetName');
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
test('should have correct annotations', () => {
|
|
36
|
-
expect(getGoogleFilePicker.definition.annotations).toEqual({
|
|
37
|
-
readOnlyHint: false,
|
|
38
|
-
openWorldHint: true,
|
|
39
|
-
destructiveHint: false
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
describe('execute - file picker URL', () => {
|
|
45
|
-
test('should return file picker URL successfully', async () => {
|
|
46
|
-
// Arrange
|
|
47
|
-
jwt.decodeJwt.mockReturnValue({
|
|
48
|
-
id: 'user-123'
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
UserModel.findByPk.mockResolvedValue({
|
|
52
|
-
id: 'user-123',
|
|
53
|
-
name: 'Test User'
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// Act
|
|
57
|
-
const result = await getGoogleFilePicker.execute({
|
|
58
|
-
jwtToken: 'mock-jwt-token'
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
// Assert
|
|
62
|
-
expect(result).toEqual({
|
|
63
|
-
success: true,
|
|
64
|
-
data: {
|
|
65
|
-
filePickerUrl: 'https://test-app-server.com/googleSheets/filePicker?token=mock-jwt-token',
|
|
66
|
-
message: expect.stringContaining('Please open this URL')
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
expect(jwt.decodeJwt).toHaveBeenCalledWith('mock-jwt-token');
|
|
70
|
-
expect(UserModel.findByPk).toHaveBeenCalledWith('user-123');
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
describe('execute - create new sheet', () => {
|
|
75
|
-
test('should create new sheet when sheetName is provided', async () => {
|
|
76
|
-
// Arrange
|
|
77
|
-
jwt.decodeJwt.mockReturnValue({
|
|
78
|
-
id: 'user-123'
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
UserModel.findByPk.mockResolvedValue({
|
|
82
|
-
id: 'user-123',
|
|
83
|
-
name: 'Test User'
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
const mockSheetResponse = {
|
|
87
|
-
data: {
|
|
88
|
-
success: true,
|
|
89
|
-
data: {
|
|
90
|
-
sheetId: 'sheet-123',
|
|
91
|
-
sheetName: 'My Call Logs'
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
axios.post.mockResolvedValue(mockSheetResponse);
|
|
97
|
-
|
|
98
|
-
// Act
|
|
99
|
-
const result = await getGoogleFilePicker.execute({
|
|
100
|
-
jwtToken: 'mock-jwt-token',
|
|
101
|
-
sheetName: 'My Call Logs'
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
// Assert
|
|
105
|
-
expect(result).toEqual({
|
|
106
|
-
success: true,
|
|
107
|
-
data: {
|
|
108
|
-
sheetId: 'sheet-123',
|
|
109
|
-
sheetName: 'My Call Logs'
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
expect(axios.post).toHaveBeenCalledWith(
|
|
113
|
-
'https://test-app-server.com/googleSheets/sheet?jwtToken=mock-jwt-token',
|
|
114
|
-
{ name: 'My Call Logs' }
|
|
115
|
-
);
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
test('should return error when sheet creation fails', async () => {
|
|
119
|
-
// Arrange
|
|
120
|
-
jwt.decodeJwt.mockReturnValue({
|
|
121
|
-
id: 'user-123'
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
UserModel.findByPk.mockResolvedValue({
|
|
125
|
-
id: 'user-123',
|
|
126
|
-
name: 'Test User'
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
axios.post.mockRejectedValue(new Error('Failed to create sheet'));
|
|
130
|
-
|
|
131
|
-
// Act
|
|
132
|
-
const result = await getGoogleFilePicker.execute({
|
|
133
|
-
jwtToken: 'mock-jwt-token',
|
|
134
|
-
sheetName: 'My Call Logs'
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
// Assert
|
|
138
|
-
expect(result.success).toBe(false);
|
|
139
|
-
expect(result.error).toBe('Failed to create sheet');
|
|
140
|
-
expect(result.errorDetails).toBeDefined();
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
describe('execute - error handling', () => {
|
|
145
|
-
test('should return error when jwtToken is missing', async () => {
|
|
146
|
-
// Act
|
|
147
|
-
const result = await getGoogleFilePicker.execute({});
|
|
148
|
-
|
|
149
|
-
// Assert
|
|
150
|
-
expect(result).toEqual({
|
|
151
|
-
success: false,
|
|
152
|
-
error: 'JWT token is required. Please connect to the CRM first using getPublicConnectors.'
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
test('should return error when jwtToken is null', async () => {
|
|
157
|
-
// Act
|
|
158
|
-
const result = await getGoogleFilePicker.execute({
|
|
159
|
-
jwtToken: null
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
// Assert
|
|
163
|
-
expect(result).toEqual({
|
|
164
|
-
success: false,
|
|
165
|
-
error: 'JWT token is required. Please connect to the CRM first using getPublicConnectors.'
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
test('should return error when JWT is invalid (no userId)', async () => {
|
|
170
|
-
// Arrange
|
|
171
|
-
jwt.decodeJwt.mockReturnValue({
|
|
172
|
-
// id is missing
|
|
173
|
-
platform: 'googleSheets'
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
// Act
|
|
177
|
-
const result = await getGoogleFilePicker.execute({
|
|
178
|
-
jwtToken: 'invalid-jwt-token'
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
// Assert
|
|
182
|
-
expect(result).toEqual({
|
|
183
|
-
success: false,
|
|
184
|
-
error: 'Invalid JWT token: userId not found'
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
test('should return error when JWT decode returns null', async () => {
|
|
189
|
-
// Arrange
|
|
190
|
-
jwt.decodeJwt.mockReturnValue(null);
|
|
191
|
-
|
|
192
|
-
// Act
|
|
193
|
-
const result = await getGoogleFilePicker.execute({
|
|
194
|
-
jwtToken: 'malformed-jwt-token'
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
// Assert
|
|
198
|
-
expect(result).toEqual({
|
|
199
|
-
success: false,
|
|
200
|
-
error: 'Invalid JWT token: userId not found'
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
test('should return error when user not found', async () => {
|
|
205
|
-
// Arrange
|
|
206
|
-
jwt.decodeJwt.mockReturnValue({
|
|
207
|
-
id: 'nonexistent-user'
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
UserModel.findByPk.mockResolvedValue(null);
|
|
211
|
-
|
|
212
|
-
// Act
|
|
213
|
-
const result = await getGoogleFilePicker.execute({
|
|
214
|
-
jwtToken: 'mock-jwt-token'
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
// Assert
|
|
218
|
-
expect(result).toEqual({
|
|
219
|
-
success: false,
|
|
220
|
-
error: 'User not found. Please connect to the CRM first using getPublicConnectors.'
|
|
221
|
-
});
|
|
222
|
-
expect(UserModel.findByPk).toHaveBeenCalledWith('nonexistent-user');
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
test('should handle database errors gracefully', async () => {
|
|
226
|
-
// Arrange
|
|
227
|
-
jwt.decodeJwt.mockReturnValue({
|
|
228
|
-
id: 'user-123'
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
UserModel.findByPk.mockRejectedValue(new Error('Database connection failed'));
|
|
232
|
-
|
|
233
|
-
// Act
|
|
234
|
-
const result = await getGoogleFilePicker.execute({
|
|
235
|
-
jwtToken: 'mock-jwt-token'
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
// Assert
|
|
239
|
-
expect(result.success).toBe(false);
|
|
240
|
-
expect(result.error).toBe('Database connection failed');
|
|
241
|
-
expect(result.errorDetails).toBeDefined();
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
test('should handle JWT decode errors gracefully', async () => {
|
|
245
|
-
// Arrange
|
|
246
|
-
jwt.decodeJwt.mockImplementation(() => {
|
|
247
|
-
throw new Error('JWT decode error');
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
// Act
|
|
251
|
-
const result = await getGoogleFilePicker.execute({
|
|
252
|
-
jwtToken: 'corrupted-jwt-token'
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
// Assert
|
|
256
|
-
expect(result.success).toBe(false);
|
|
257
|
-
expect(result.error).toBe('JWT decode error');
|
|
258
|
-
expect(result.errorDetails).toBeDefined();
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
test('should handle errors without message property', async () => {
|
|
262
|
-
// Arrange
|
|
263
|
-
jwt.decodeJwt.mockReturnValue({
|
|
264
|
-
id: 'user-123'
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
const errorWithoutMessage = { code: 'UNKNOWN_ERROR' };
|
|
268
|
-
UserModel.findByPk.mockRejectedValue(errorWithoutMessage);
|
|
269
|
-
|
|
270
|
-
// Act
|
|
271
|
-
const result = await getGoogleFilePicker.execute({
|
|
272
|
-
jwtToken: 'mock-jwt-token'
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
// Assert
|
|
276
|
-
expect(result.success).toBe(false);
|
|
277
|
-
expect(result.error).toBe('Unknown error occurred');
|
|
278
|
-
});
|
|
279
|
-
});
|
|
280
|
-
});
|
|
281
|
-
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
const getPublicConnectors = require('../../../mcp/tools/getPublicConnectors');
|
|
2
|
-
const axios = require('axios');
|
|
3
|
-
|
|
4
|
-
jest.mock('axios');
|
|
5
|
-
|
|
6
|
-
describe('MCP Tool: getPublicConnectors', () => {
|
|
7
|
-
beforeEach(() => {
|
|
8
|
-
jest.clearAllMocks();
|
|
9
|
-
process.env.APP_SERVER = 'https://test-server.com';
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
describe('tool definition', () => {
|
|
13
|
-
test('should have correct tool definition', () => {
|
|
14
|
-
expect(getPublicConnectors.definition).toBeDefined();
|
|
15
|
-
expect(getPublicConnectors.definition.name).toBe('getPublicConnectors');
|
|
16
|
-
expect(getPublicConnectors.definition.description).toContain('connectors');
|
|
17
|
-
expect(getPublicConnectors.definition.inputSchema).toBeDefined();
|
|
18
|
-
expect(getPublicConnectors.definition.inputSchema.type).toBe('object');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test('should have no required parameters', () => {
|
|
22
|
-
expect(getPublicConnectors.definition.inputSchema.required).toEqual([]);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
describe('execute', () => {
|
|
27
|
-
test('should return structuredContent with server URL when no rcAccessToken', async () => {
|
|
28
|
-
// Act
|
|
29
|
-
const result = await getPublicConnectors.execute({});
|
|
30
|
-
|
|
31
|
-
// Assert
|
|
32
|
-
expect(result).toEqual({
|
|
33
|
-
structuredContent: {
|
|
34
|
-
serverUrl: 'https://test-server.com',
|
|
35
|
-
rcExtensionId: null,
|
|
36
|
-
rcAccountId: null,
|
|
37
|
-
openaiSessionId: null,
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
expect(axios.get).not.toHaveBeenCalled();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test('should resolve RC account and extension IDs when rcAccessToken provided', async () => {
|
|
44
|
-
// Arrange
|
|
45
|
-
axios.get.mockResolvedValue({
|
|
46
|
-
data: { id: 'ext-456', account: { id: 'acc-789' } }
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// Act
|
|
50
|
-
const result = await getPublicConnectors.execute({
|
|
51
|
-
rcAccessToken: 'valid-rc-token',
|
|
52
|
-
openaiSessionId: 'session-abc'
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
// Assert
|
|
56
|
-
expect(result).toEqual({
|
|
57
|
-
structuredContent: {
|
|
58
|
-
serverUrl: 'https://test-server.com',
|
|
59
|
-
rcExtensionId: 'ext-456',
|
|
60
|
-
rcAccountId: 'acc-789',
|
|
61
|
-
openaiSessionId: 'session-abc',
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
expect(axios.get).toHaveBeenCalledWith(
|
|
65
|
-
'https://platform.ringcentral.com/restapi/v1.0/account/~/extension/~',
|
|
66
|
-
{ headers: { Authorization: 'Bearer valid-rc-token' } }
|
|
67
|
-
);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
test('should return null RC IDs and continue when RC API call fails', async () => {
|
|
71
|
-
// Arrange — RC API failure is non-fatal: widget only shows public connectors
|
|
72
|
-
axios.get.mockRejectedValue(new Error('RC API unavailable'));
|
|
73
|
-
|
|
74
|
-
// Act
|
|
75
|
-
const result = await getPublicConnectors.execute({ rcAccessToken: 'bad-token' });
|
|
76
|
-
|
|
77
|
-
// Assert — still returns structuredContent, just without RC IDs
|
|
78
|
-
expect(result).toEqual({
|
|
79
|
-
structuredContent: {
|
|
80
|
-
serverUrl: 'https://test-server.com',
|
|
81
|
-
rcExtensionId: null,
|
|
82
|
-
rcAccountId: null,
|
|
83
|
-
openaiSessionId: null,
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
test('should include openaiSessionId when provided', async () => {
|
|
89
|
-
// Act
|
|
90
|
-
const result = await getPublicConnectors.execute({ openaiSessionId: 'my-session' });
|
|
91
|
-
|
|
92
|
-
// Assert
|
|
93
|
-
expect(result.structuredContent.openaiSessionId).toBe('my-session');
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
test('should use default server URL when APP_SERVER is not set', async () => {
|
|
97
|
-
// Arrange
|
|
98
|
-
delete process.env.APP_SERVER;
|
|
99
|
-
|
|
100
|
-
// Act
|
|
101
|
-
const result = await getPublicConnectors.execute({});
|
|
102
|
-
|
|
103
|
-
// Assert
|
|
104
|
-
expect(result.structuredContent.serverUrl).toBe('https://localhost:6066');
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
});
|