@hubspot/cli 7.10.0-beta.1 → 7.10.0-experimental.0
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/bin/cli.js +5 -4
- package/commands/__tests__/getStarted.test.js +10 -0
- package/commands/__tests__/project.test.js +3 -0
- package/commands/account/__tests__/rename.test.js +10 -3
- package/commands/account/auth.js +10 -14
- package/commands/account/clean.js +11 -19
- package/commands/account/createOverride.js +15 -11
- package/commands/account/info.js +8 -5
- package/commands/account/list.js +15 -19
- package/commands/account/remove.js +23 -22
- package/commands/account/removeOverride.js +6 -6
- package/commands/account/rename.js +2 -2
- package/commands/account/use.js +19 -8
- package/commands/app/__tests__/migrate.test.js +8 -4
- package/commands/app/migrate.js +2 -2
- package/commands/auth.js +18 -14
- package/commands/config/migrate.js +5 -5
- package/commands/customObject/createSchema.js +2 -3
- package/commands/customObject/updateSchema.js +2 -3
- package/commands/getStarted.js +2 -3
- package/commands/hubdb/__tests__/list.test.js +1 -0
- package/commands/hubdb/list.js +2 -2
- package/commands/init.js +36 -32
- package/commands/project/__tests__/deploy.test.js +10 -5
- package/commands/project/__tests__/devUnifiedFlow.test.js +6 -4
- package/commands/project/__tests__/lint.test.js +709 -0
- package/commands/project/__tests__/logs.test.js +4 -0
- package/commands/project/__tests__/validate.test.js +2 -2
- package/commands/project/cloneApp.js +2 -2
- package/commands/project/deploy.js +2 -2
- package/commands/project/dev/deprecatedFlow.js +4 -5
- package/commands/project/dev/index.js +6 -3
- package/commands/project/dev/unifiedFlow.js +4 -5
- package/commands/project/lint.d.ts +6 -0
- package/commands/project/lint.js +178 -0
- package/commands/project/logs.js +2 -3
- package/commands/project/profile/add.js +6 -7
- package/commands/project/profile/delete.js +2 -2
- package/commands/project/upload.js +2 -2
- package/commands/project/validate.js +2 -2
- package/commands/project.js +2 -0
- package/commands/sandbox/__tests__/create.test.js +14 -5
- package/commands/sandbox/create.js +4 -5
- package/commands/sandbox/delete.js +23 -20
- package/commands/testAccount/__tests__/create.test.js +5 -5
- package/commands/testAccount/create.js +2 -2
- package/commands/testAccount/delete.js +9 -8
- package/lang/en.d.ts +40 -6
- package/lang/en.js +54 -14
- package/lib/__tests__/buildAccount.test.js +22 -30
- package/lib/__tests__/commonOpts.test.js +9 -13
- package/lib/__tests__/developerTestAccounts.test.js +29 -17
- package/lib/__tests__/importData.test.js +20 -10
- package/lib/__tests__/oauth.test.js +19 -8
- package/lib/__tests__/sandboxSync.test.js +33 -11
- package/lib/__tests__/sandboxes.test.js +30 -19
- package/lib/__tests__/usageTracking.test.js +10 -10
- package/lib/__tests__/validation.test.js +32 -32
- package/lib/accountTypes.d.ts +9 -9
- package/lib/accountTypes.js +2 -4
- package/lib/app/__tests__/migrate.test.js +15 -0
- package/lib/app/__tests__/migrate_legacy.test.js +9 -0
- package/lib/app/migrate_legacy.d.ts +2 -2
- package/lib/buildAccount.d.ts +4 -4
- package/lib/buildAccount.js +7 -14
- package/lib/commonOpts.js +3 -3
- package/lib/configMigrate.d.ts +2 -2
- package/lib/configMigrate.js +42 -18
- package/lib/configOptions.js +3 -2
- package/lib/developerTestAccounts.d.ts +3 -3
- package/lib/developerTestAccounts.js +4 -7
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +1 -1
- package/lib/doctor/DiagnosticInfoBuilder.js +9 -6
- package/lib/doctor/Doctor.js +4 -3
- package/lib/doctor/__tests__/Diagnosis.test.js +4 -3
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +17 -9
- package/lib/doctor/__tests__/Doctor.test.js +14 -0
- package/lib/importData.js +8 -7
- package/lib/links.js +5 -5
- package/lib/middleware/{__test__ → __tests__}/commandTargetingUtils.test.js +3 -3
- package/lib/middleware/{__test__ → __tests__}/configMiddleware.test.js +23 -22
- package/lib/middleware/{__test__ → __tests__}/gitMiddleware.test.js +9 -7
- package/lib/middleware/autoUpdateMiddleware.js +12 -4
- package/lib/middleware/commandTargetingUtils.js +3 -2
- package/lib/middleware/configMiddleware.d.ts +6 -1
- package/lib/middleware/configMiddleware.js +36 -15
- package/lib/middleware/gitMiddleware.js +8 -4
- package/lib/oauth.d.ts +2 -2
- package/lib/oauth.js +8 -10
- package/lib/projects/__tests__/AppDevModeInterface.test.js +17 -6
- package/lib/projects/__tests__/DevServerManager.test.js +1 -0
- package/lib/projects/__tests__/LocalDevProcess.test.js +1 -0
- package/lib/projects/__tests__/components.test.js +1 -1
- package/lib/projects/__tests__/deploy.test.js +1 -0
- package/lib/projects/__tests__/uieLinting.test.js +640 -0
- package/lib/projects/components.js +1 -1
- package/lib/projects/create/__tests__/v2.test.js +11 -0
- package/lib/projects/localDev/AppDevModeInterface.js +2 -2
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +2 -2
- package/lib/projects/localDev/DevSessionManager.d.ts +17 -0
- package/lib/projects/localDev/DevSessionManager.js +56 -0
- package/lib/projects/localDev/LocalDevLogger.d.ts +3 -0
- package/lib/projects/localDev/LocalDevLogger.js +13 -4
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.js +3 -3
- package/lib/projects/localDev/LocalDevProcess.d.ts +1 -0
- package/lib/projects/localDev/LocalDevProcess.js +12 -1
- package/lib/projects/localDev/LocalDevState.d.ts +3 -0
- package/lib/projects/localDev/LocalDevState.js +9 -0
- package/lib/projects/localDev/helpers/account.d.ts +10 -10
- package/lib/projects/localDev/helpers/account.js +6 -11
- package/lib/projects/localDev/helpers/devSessionsApi.d.ts +9 -0
- package/lib/projects/localDev/helpers/devSessionsApi.js +19 -0
- package/lib/projects/uieLinting.d.ts +33 -0
- package/lib/projects/uieLinting.js +222 -0
- package/lib/projects/urls.js +5 -6
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +7 -5
- package/lib/prompts/accountNamePrompt.js +3 -3
- package/lib/prompts/accountsPrompt.d.ts +1 -1
- package/lib/prompts/accountsPrompt.js +6 -7
- package/lib/prompts/confirmImportDataPrompt.js +2 -2
- package/lib/prompts/downloadProjectPrompt.d.ts +1 -0
- package/lib/prompts/downloadProjectPrompt.js +5 -2
- package/lib/prompts/importDataTestAccountSelectPrompt.js +4 -5
- package/lib/prompts/personalAccessKeyPrompt.js +2 -2
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +3 -3
- package/lib/prompts/projectDevTargetAccountPrompt.js +5 -7
- package/lib/prompts/sandboxesPrompt.js +7 -8
- package/lib/prompts/setAsDefaultAccountPrompt.js +7 -6
- package/lib/sandboxSync.d.ts +2 -2
- package/lib/sandboxSync.js +3 -9
- package/lib/sandboxes.d.ts +4 -4
- package/lib/sandboxes.js +6 -11
- package/lib/serverlessLogs.js +2 -2
- package/lib/theme/__tests__/migrate.test.js +15 -0
- package/lib/ui/index.js +6 -3
- package/lib/usageTracking.js +15 -8
- package/lib/validation.js +13 -11
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +4 -2
- package/mcp-server/tools/cms/HsCreateModuleTool.js +4 -2
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +4 -2
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +4 -2
- package/mcp-server/tools/cms/HsListFunctionsTool.js +3 -1
- package/mcp-server/tools/cms/HsListTool.js +3 -1
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +1 -0
- package/mcp-server/tools/index.js +4 -0
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +4 -2
- package/mcp-server/tools/project/CreateProjectTool.js +4 -2
- package/mcp-server/tools/project/CreateTestAccountTool.js +42 -19
- package/mcp-server/tools/project/DeployProjectTool.js +3 -1
- package/mcp-server/tools/project/DocFetchTool.js +6 -4
- package/mcp-server/tools/project/DocsSearchTool.d.ts +1 -1
- package/mcp-server/tools/project/DocsSearchTool.js +10 -8
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +1 -1
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +9 -7
- package/mcp-server/tools/project/GetApplicationInfoTool.js +8 -6
- package/mcp-server/tools/project/GetBuildLogsTool.d.ts +26 -0
- package/mcp-server/tools/project/GetBuildLogsTool.js +125 -0
- package/mcp-server/tools/project/GetBuildStatusTool.d.ts +26 -0
- package/mcp-server/tools/project/GetBuildStatusTool.js +166 -0
- package/mcp-server/tools/project/GetConfigValuesTool.d.ts +1 -1
- package/mcp-server/tools/project/GetConfigValuesTool.js +9 -7
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +1 -1
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +5 -3
- package/mcp-server/tools/project/UploadProjectTools.js +3 -1
- package/mcp-server/tools/project/ValidateProjectTool.js +4 -2
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.js +226 -3
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +5 -1
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +23 -11
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +7 -5
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +7 -5
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.js +305 -0
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.js +240 -0
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +8 -6
- package/mcp-server/utils/__tests__/content.test.js +21 -20
- package/mcp-server/utils/__tests__/feedbackTracking.test.js +34 -28
- package/mcp-server/utils/config.d.ts +1 -0
- package/mcp-server/utils/config.js +10 -0
- package/mcp-server/utils/content.d.ts +1 -1
- package/mcp-server/utils/content.js +2 -2
- package/mcp-server/utils/feedbackTracking.d.ts +1 -1
- package/mcp-server/utils/feedbackTracking.js +3 -3
- package/mcp-server/utils/toolUsageTracking.js +4 -3
- package/package.json +8 -7
- package/types/LocalDev.d.ts +1 -0
- package/lib/middleware/__test__/notificationsMiddleware.test.js +0 -8
- package/lib/middleware/notificationsMiddleware.d.ts +0 -1
- package/lib/middleware/notificationsMiddleware.js +0 -28
- package/mcp-server/utils/__tests__/cliConfig.test.js +0 -110
- package/mcp-server/utils/cliConfig.d.ts +0 -1
- package/mcp-server/utils/cliConfig.js +0 -12
- /package/{lib/middleware/__test__/commandTargetingUtils.test.d.ts → commands/project/__tests__/lint.test.d.ts} +0 -0
- /package/lib/middleware/{__test__/configMiddleware.test.d.ts → __tests__/commandTargetingUtils.test.d.ts} +0 -0
- /package/lib/middleware/{__test__/gitMiddleware.test.d.ts → __tests__/configMiddleware.test.d.ts} +0 -0
- /package/lib/middleware/{__test__/notificationsMiddleware.test.d.ts → __tests__/gitMiddleware.test.d.ts} +0 -0
- /package/lib/middleware/{__test__ → __tests__}/requestMiddleware.test.d.ts +0 -0
- /package/lib/middleware/{__test__ → __tests__}/requestMiddleware.test.js +0 -0
- /package/lib/middleware/{__test__ → __tests__}/yargsChecksMiddleware.test.d.ts +0 -0
- /package/lib/middleware/{__test__ → __tests__}/yargsChecksMiddleware.test.js +0 -0
- /package/{mcp-server/utils/__tests__/cliConfig.test.d.ts → lib/projects/__tests__/uieLinting.test.d.ts} +0 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { GetBuildLogsTool } from '../GetBuildLogsTool.js';
|
|
2
|
+
import { http } from '@hubspot/local-dev-lib/http';
|
|
3
|
+
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
4
|
+
import { getProjectConfig, validateProjectConfig, } from '../../../../lib/projects/config.js';
|
|
5
|
+
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
6
|
+
import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
|
|
7
|
+
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
8
|
+
vi.mock('../../../utils/toolUsageTracking');
|
|
9
|
+
vi.mock('../../../utils/cliConfig');
|
|
10
|
+
vi.mock('@hubspot/local-dev-lib/http');
|
|
11
|
+
vi.mock('@hubspot/local-dev-lib/errors/index');
|
|
12
|
+
vi.mock('../../../../lib/projects/config.js');
|
|
13
|
+
vi.mock('../../../utils/feedbackTracking');
|
|
14
|
+
vi.mock('@hubspot/local-dev-lib/config');
|
|
15
|
+
const mockMcpFeedbackRequest = mcpFeedbackRequest;
|
|
16
|
+
const mockGetConfigDefaultAccountIfExists = getConfigDefaultAccountIfExists;
|
|
17
|
+
const mockHttpGet = http.get;
|
|
18
|
+
const mockIsHubSpotHttpError = isHubSpotHttpError;
|
|
19
|
+
const mockGetProjectConfig = getProjectConfig;
|
|
20
|
+
const mockValidateProjectConfig = validateProjectConfig;
|
|
21
|
+
const TEST_ACCOUNT_ID = 123456789;
|
|
22
|
+
const TEST_PROJECT_NAME = 'test-project';
|
|
23
|
+
const TEST_PROJECT_PATH = '/test/project';
|
|
24
|
+
const TEST_WORKING_DIR = '/test';
|
|
25
|
+
const TEST_BUILD_ID = 123;
|
|
26
|
+
const TEST_PLATFORM_VERSION = '2025.2';
|
|
27
|
+
function createMockLog(overrides = {}) {
|
|
28
|
+
return {
|
|
29
|
+
lineNumber: 1,
|
|
30
|
+
logLevel: 'INFO',
|
|
31
|
+
message: 'Starting build validation',
|
|
32
|
+
pipelineStepId: 1,
|
|
33
|
+
pipelineSubstepId: 'test-step',
|
|
34
|
+
pipelineSubstepName: 'test-component',
|
|
35
|
+
timestamp: Date.now(),
|
|
36
|
+
...overrides,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function createMockLogs() {
|
|
40
|
+
return {
|
|
41
|
+
pipelineStage: 'BUILD',
|
|
42
|
+
pipelineStepId: 2,
|
|
43
|
+
projectName: TEST_PROJECT_NAME,
|
|
44
|
+
logs: [
|
|
45
|
+
{
|
|
46
|
+
pipelineStepId: 2,
|
|
47
|
+
pipelineSubstepId: 'test-app-id',
|
|
48
|
+
pipelineStage: 'BUILD',
|
|
49
|
+
projectName: TEST_PROJECT_NAME,
|
|
50
|
+
logs: [
|
|
51
|
+
createMockLog({
|
|
52
|
+
lineNumber: 1,
|
|
53
|
+
logLevel: 'INFO',
|
|
54
|
+
message: "Starting build validation for app 'Test App'",
|
|
55
|
+
pipelineSubstepName: 'test-app',
|
|
56
|
+
pipelineSubstepId: 'test-app-id',
|
|
57
|
+
}),
|
|
58
|
+
createMockLog({
|
|
59
|
+
lineNumber: 2,
|
|
60
|
+
logLevel: 'INFO',
|
|
61
|
+
message: "Successfully validated app configuration for 'Test App'",
|
|
62
|
+
pipelineSubstepName: 'test-app',
|
|
63
|
+
pipelineSubstepId: 'test-app-id',
|
|
64
|
+
}),
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
pipelineStepId: 2,
|
|
69
|
+
pipelineSubstepId: 'test-card-id',
|
|
70
|
+
pipelineStage: 'BUILD',
|
|
71
|
+
projectName: TEST_PROJECT_NAME,
|
|
72
|
+
logs: [
|
|
73
|
+
createMockLog({
|
|
74
|
+
lineNumber: 1,
|
|
75
|
+
logLevel: 'INFO',
|
|
76
|
+
message: 'Starting card build...',
|
|
77
|
+
pipelineSubstepName: 'test-card',
|
|
78
|
+
pipelineSubstepId: 'test-card-id',
|
|
79
|
+
}),
|
|
80
|
+
createMockLog({
|
|
81
|
+
lineNumber: 2,
|
|
82
|
+
logLevel: 'INFO',
|
|
83
|
+
message: 'Validating card configuration...',
|
|
84
|
+
pipelineSubstepName: 'test-card',
|
|
85
|
+
pipelineSubstepId: 'test-card-id',
|
|
86
|
+
}),
|
|
87
|
+
createMockLog({
|
|
88
|
+
lineNumber: 3,
|
|
89
|
+
logLevel: 'ERROR',
|
|
90
|
+
message: 'Failed to build card. The preview image file /app/cards/assets/preview.png was not found. Make sure the file exists in /app/cards and try again.',
|
|
91
|
+
pipelineSubstepName: 'test-card',
|
|
92
|
+
pipelineSubstepId: 'test-card-id',
|
|
93
|
+
}),
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
pipelineStepId: 2,
|
|
98
|
+
pipelineSubstepId: 'test-webhook-id',
|
|
99
|
+
pipelineStage: 'BUILD',
|
|
100
|
+
projectName: TEST_PROJECT_NAME,
|
|
101
|
+
logs: [
|
|
102
|
+
createMockLog({
|
|
103
|
+
lineNumber: 1,
|
|
104
|
+
logLevel: 'WARN',
|
|
105
|
+
message: 'Deprecated API usage detected in webhook configuration',
|
|
106
|
+
pipelineSubstepName: 'test-webhook',
|
|
107
|
+
pipelineSubstepId: 'test-webhook-id',
|
|
108
|
+
}),
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function createLogsResponse(data) {
|
|
115
|
+
return {
|
|
116
|
+
data,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function createMockProjectConfig(overrides = {}) {
|
|
120
|
+
return {
|
|
121
|
+
name: TEST_PROJECT_NAME,
|
|
122
|
+
srcDir: 'src',
|
|
123
|
+
platformVersion: TEST_PLATFORM_VERSION,
|
|
124
|
+
...overrides,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function expectTextContent(result, ...expectedStrings) {
|
|
128
|
+
expectedStrings.forEach(str => {
|
|
129
|
+
expect(result.content[1].text).toContain(str);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
describe('mcp-server/tools/project/GetBuildLogsTool', () => {
|
|
133
|
+
let mockMcpServer;
|
|
134
|
+
let tool;
|
|
135
|
+
let mockRegisteredTool;
|
|
136
|
+
beforeEach(() => {
|
|
137
|
+
vi.clearAllMocks();
|
|
138
|
+
// @ts-expect-error Not mocking the whole thing
|
|
139
|
+
mockMcpServer = {
|
|
140
|
+
registerTool: vi.fn(),
|
|
141
|
+
};
|
|
142
|
+
mockRegisteredTool = {};
|
|
143
|
+
mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
|
|
144
|
+
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
145
|
+
tool = new GetBuildLogsTool(mockMcpServer);
|
|
146
|
+
// Default mock implementations
|
|
147
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue({
|
|
148
|
+
accountId: TEST_ACCOUNT_ID,
|
|
149
|
+
});
|
|
150
|
+
mockIsHubSpotHttpError.mockReturnValue(false);
|
|
151
|
+
mockGetProjectConfig.mockResolvedValue({
|
|
152
|
+
projectConfig: createMockProjectConfig(),
|
|
153
|
+
projectDir: TEST_PROJECT_PATH,
|
|
154
|
+
});
|
|
155
|
+
mockValidateProjectConfig.mockImplementation(() => { });
|
|
156
|
+
});
|
|
157
|
+
describe('register', () => {
|
|
158
|
+
it('should register tool with correct parameters', () => {
|
|
159
|
+
const result = tool.register();
|
|
160
|
+
expect(mockMcpServer.registerTool).toHaveBeenCalledWith('get-build-logs', expect.objectContaining({
|
|
161
|
+
title: 'Get HubSpot Project Build Logs',
|
|
162
|
+
description: expect.stringContaining('Retrieves build logs for a specific HubSpot project build'),
|
|
163
|
+
inputSchema: expect.anything(),
|
|
164
|
+
}), expect.any(Function));
|
|
165
|
+
expect(result).toBe(mockRegisteredTool);
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
describe('handler', () => {
|
|
169
|
+
const baseInput = {
|
|
170
|
+
absoluteProjectPath: TEST_PROJECT_PATH,
|
|
171
|
+
absoluteCurrentWorkingDirectory: TEST_WORKING_DIR,
|
|
172
|
+
buildId: TEST_BUILD_ID,
|
|
173
|
+
logLevel: 'ALL',
|
|
174
|
+
};
|
|
175
|
+
describe('error handling', () => {
|
|
176
|
+
it('should return error when account ID cannot be determined', async () => {
|
|
177
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
|
|
178
|
+
const result = await tool.handler(baseInput);
|
|
179
|
+
expect(result).toEqual({
|
|
180
|
+
content: [
|
|
181
|
+
{
|
|
182
|
+
type: 'text',
|
|
183
|
+
text: TEST_WORKING_DIR,
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
type: 'text',
|
|
187
|
+
text: 'No account ID found. Please run `hs account auth` to configure an account, or set a default account with `hs account use <account>`',
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
});
|
|
191
|
+
expect(mockHttpGet).not.toHaveBeenCalled();
|
|
192
|
+
});
|
|
193
|
+
it('should handle HubSpot HTTP errors', async () => {
|
|
194
|
+
const error = new Error('API Error');
|
|
195
|
+
mockIsHubSpotHttpError.mockReturnValue(true);
|
|
196
|
+
mockHttpGet.mockRejectedValue(error);
|
|
197
|
+
const result = await tool.handler(baseInput);
|
|
198
|
+
expectTextContent(result, 'API Error');
|
|
199
|
+
});
|
|
200
|
+
it('should handle generic errors', async () => {
|
|
201
|
+
const error = new Error('Generic error');
|
|
202
|
+
mockIsHubSpotHttpError.mockReturnValue(false);
|
|
203
|
+
mockHttpGet.mockRejectedValue(error);
|
|
204
|
+
const result = await tool.handler(baseInput);
|
|
205
|
+
expectTextContent(result, 'Generic error');
|
|
206
|
+
});
|
|
207
|
+
it('should handle empty logs', async () => {
|
|
208
|
+
const emptyLogsResponse = {
|
|
209
|
+
pipelineStage: 'BUILD',
|
|
210
|
+
pipelineStepId: 2,
|
|
211
|
+
projectName: TEST_PROJECT_NAME,
|
|
212
|
+
logs: [],
|
|
213
|
+
};
|
|
214
|
+
mockHttpGet.mockResolvedValue(
|
|
215
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
216
|
+
createLogsResponse(emptyLogsResponse));
|
|
217
|
+
const result = await tool.handler(baseInput);
|
|
218
|
+
expectTextContent(result, `No logs found for build #${TEST_BUILD_ID}`, TEST_PROJECT_NAME);
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
describe('log fetching', () => {
|
|
222
|
+
it('should fetch and display all logs', async () => {
|
|
223
|
+
const mockLogs = createMockLogs();
|
|
224
|
+
mockHttpGet.mockResolvedValue(
|
|
225
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
226
|
+
createLogsResponse(mockLogs));
|
|
227
|
+
const result = await tool.handler(baseInput);
|
|
228
|
+
expect(mockGetProjectConfig).toHaveBeenCalledWith(TEST_PROJECT_PATH);
|
|
229
|
+
expect(mockHttpGet).toHaveBeenCalledWith(TEST_ACCOUNT_ID, {
|
|
230
|
+
url: `dfs/logging/v1/logs/projects/${TEST_PROJECT_NAME}/builds/${TEST_BUILD_ID}`,
|
|
231
|
+
});
|
|
232
|
+
expectTextContent(result, `Logs for build #${TEST_BUILD_ID}`, TEST_PROJECT_NAME, 'ALL level', 'Starting build validation', 'Successfully validated', 'Failed to build card', 'Deprecated API usage');
|
|
233
|
+
});
|
|
234
|
+
it('should filter logs by ERROR level', async () => {
|
|
235
|
+
const mockLogs = createMockLogs();
|
|
236
|
+
mockHttpGet.mockResolvedValue(
|
|
237
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
238
|
+
createLogsResponse(mockLogs));
|
|
239
|
+
const result = await tool.handler({
|
|
240
|
+
...baseInput,
|
|
241
|
+
logLevel: 'ERROR',
|
|
242
|
+
});
|
|
243
|
+
expectTextContent(result, 'ERROR level', 'Failed to build card', 'preview.png was not found');
|
|
244
|
+
expect(result.content[1].text).not.toContain('Starting build');
|
|
245
|
+
expect(result.content[1].text).not.toContain('Deprecated API');
|
|
246
|
+
});
|
|
247
|
+
it('should filter logs by WARN level', async () => {
|
|
248
|
+
const mockLogs = createMockLogs();
|
|
249
|
+
mockHttpGet.mockResolvedValue(
|
|
250
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
251
|
+
createLogsResponse(mockLogs));
|
|
252
|
+
const result = await tool.handler({
|
|
253
|
+
...baseInput,
|
|
254
|
+
logLevel: 'WARN',
|
|
255
|
+
});
|
|
256
|
+
expectTextContent(result, 'WARN level', 'Deprecated API usage detected');
|
|
257
|
+
expect(result.content[1].text).not.toContain('Starting build');
|
|
258
|
+
expect(result.content[1].text).not.toContain('Failed to build card');
|
|
259
|
+
});
|
|
260
|
+
it('should filter logs by INFO level', async () => {
|
|
261
|
+
const mockLogs = createMockLogs();
|
|
262
|
+
mockHttpGet.mockResolvedValue(
|
|
263
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
264
|
+
createLogsResponse(mockLogs));
|
|
265
|
+
const result = await tool.handler({
|
|
266
|
+
...baseInput,
|
|
267
|
+
logLevel: 'INFO',
|
|
268
|
+
});
|
|
269
|
+
expectTextContent(result, 'INFO level', 'Starting build validation', 'Successfully validated');
|
|
270
|
+
expect(result.content[1].text).not.toContain('Failed to build card');
|
|
271
|
+
expect(result.content[1].text).not.toContain('Deprecated API');
|
|
272
|
+
});
|
|
273
|
+
it('should show all logs when no logs match filter', async () => {
|
|
274
|
+
const infoOnlyResponse = {
|
|
275
|
+
pipelineStage: 'BUILD',
|
|
276
|
+
pipelineStepId: 2,
|
|
277
|
+
projectName: TEST_PROJECT_NAME,
|
|
278
|
+
logs: [
|
|
279
|
+
{
|
|
280
|
+
pipelineStepId: 2,
|
|
281
|
+
pipelineSubstepId: 'info-only-id',
|
|
282
|
+
pipelineStage: 'BUILD',
|
|
283
|
+
projectName: TEST_PROJECT_NAME,
|
|
284
|
+
logs: [
|
|
285
|
+
createMockLog({
|
|
286
|
+
logLevel: 'INFO',
|
|
287
|
+
message: 'Info message only',
|
|
288
|
+
pipelineSubstepId: 'info-only-id',
|
|
289
|
+
}),
|
|
290
|
+
],
|
|
291
|
+
},
|
|
292
|
+
],
|
|
293
|
+
};
|
|
294
|
+
mockHttpGet.mockResolvedValue(
|
|
295
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
296
|
+
createLogsResponse(infoOnlyResponse));
|
|
297
|
+
const result = await tool.handler({
|
|
298
|
+
...baseInput,
|
|
299
|
+
logLevel: 'ERROR',
|
|
300
|
+
});
|
|
301
|
+
expectTextContent(result, `No ERROR level logs found`, `build #${TEST_BUILD_ID}`, 'Showing all logs instead', 'Info message only');
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { GetBuildStatusTool } from '../GetBuildStatusTool.js';
|
|
2
|
+
import { fetchProjectBuilds, getBuildStatus, } from '@hubspot/local-dev-lib/api/projects';
|
|
3
|
+
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
4
|
+
import { getProjectConfig, validateProjectConfig, } from '../../../../lib/projects/config.js';
|
|
5
|
+
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
6
|
+
import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
|
|
7
|
+
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
8
|
+
vi.mock('../../../utils/toolUsageTracking');
|
|
9
|
+
vi.mock('@hubspot/local-dev-lib/api/projects');
|
|
10
|
+
vi.mock('@hubspot/local-dev-lib/errors/index');
|
|
11
|
+
vi.mock('../../../../lib/projects/config.js');
|
|
12
|
+
vi.mock('../../../utils/feedbackTracking');
|
|
13
|
+
vi.mock('@hubspot/local-dev-lib/config');
|
|
14
|
+
const mockMcpFeedbackRequest = mcpFeedbackRequest;
|
|
15
|
+
const mockFetchProjectBuilds = fetchProjectBuilds;
|
|
16
|
+
const mockGetBuildStatus = getBuildStatus;
|
|
17
|
+
const mockIsHubSpotHttpError = isHubSpotHttpError;
|
|
18
|
+
const mockGetProjectConfig = getProjectConfig;
|
|
19
|
+
const mockValidateProjectConfig = validateProjectConfig;
|
|
20
|
+
const mockGetConfigDefaultAccountIfExists = getConfigDefaultAccountIfExists;
|
|
21
|
+
const TEST_ACCOUNT_ID = 123456789;
|
|
22
|
+
const TEST_PROJECT_NAME = 'test-project';
|
|
23
|
+
const TEST_PROJECT_PATH = '/test/project';
|
|
24
|
+
const TEST_WORKING_DIR = '/test';
|
|
25
|
+
const TEST_PLATFORM_VERSION = '2025.2';
|
|
26
|
+
function createMockBuild(overrides = {}) {
|
|
27
|
+
return {
|
|
28
|
+
buildId: 10,
|
|
29
|
+
status: 'FAILURE',
|
|
30
|
+
createdAt: '2025-11-18T21:50:50.632Z',
|
|
31
|
+
enqueuedAt: null,
|
|
32
|
+
finishedAt: '2025-11-20T22:32:07.008Z',
|
|
33
|
+
startedAt: '2025-11-18T21:50:50.632Z',
|
|
34
|
+
subbuildStatuses: [
|
|
35
|
+
{
|
|
36
|
+
buildName: 'my-card',
|
|
37
|
+
buildType: 'CARD',
|
|
38
|
+
status: 'FAILURE',
|
|
39
|
+
errorMessage: 'There were errors building this component:\n - The preview image file /app/cards/assets/preview.png was not found. Make sure the file exists in /app/cards and try again.',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
buildName: 'my-app',
|
|
43
|
+
buildType: 'APPLICATION',
|
|
44
|
+
status: 'SUCCESS',
|
|
45
|
+
errorMessage: '',
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
buildErrorMessage: 'The source code for this project is too large. HubSpot projects have a maximum size limit of 50.0 MB.',
|
|
49
|
+
platformVersion: TEST_PLATFORM_VERSION,
|
|
50
|
+
deployable: true,
|
|
51
|
+
deployableState: 'DEPLOYABLE',
|
|
52
|
+
...overrides,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function createMockProjectConfig(overrides = {}) {
|
|
56
|
+
return {
|
|
57
|
+
name: TEST_PROJECT_NAME,
|
|
58
|
+
srcDir: 'src',
|
|
59
|
+
platformVersion: TEST_PLATFORM_VERSION,
|
|
60
|
+
...overrides,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function createBuildListResponse(builds) {
|
|
64
|
+
return {
|
|
65
|
+
data: {
|
|
66
|
+
results: builds,
|
|
67
|
+
paging: undefined,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function createBuildDetailsResponse(build) {
|
|
72
|
+
return {
|
|
73
|
+
data: build,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function expectTextContent(result, ...expectedStrings) {
|
|
77
|
+
expectedStrings.forEach(str => {
|
|
78
|
+
expect(result.content[1].text).toContain(str);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
describe('mcp-server/tools/project/GetBuildStatusTool', () => {
|
|
82
|
+
let mockMcpServer;
|
|
83
|
+
let tool;
|
|
84
|
+
let mockRegisteredTool;
|
|
85
|
+
beforeEach(() => {
|
|
86
|
+
vi.clearAllMocks();
|
|
87
|
+
// @ts-expect-error Not mocking the whole thing
|
|
88
|
+
mockMcpServer = {
|
|
89
|
+
registerTool: vi.fn(),
|
|
90
|
+
};
|
|
91
|
+
mockRegisteredTool = {};
|
|
92
|
+
mockMcpServer.registerTool.mockReturnValue(mockRegisteredTool);
|
|
93
|
+
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
94
|
+
tool = new GetBuildStatusTool(mockMcpServer);
|
|
95
|
+
// Default mock implementations
|
|
96
|
+
mockIsHubSpotHttpError.mockReturnValue(false);
|
|
97
|
+
mockGetProjectConfig.mockResolvedValue({
|
|
98
|
+
projectConfig: createMockProjectConfig(),
|
|
99
|
+
projectDir: TEST_PROJECT_PATH,
|
|
100
|
+
});
|
|
101
|
+
mockValidateProjectConfig.mockImplementation(() => { });
|
|
102
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue({
|
|
103
|
+
accountId: TEST_ACCOUNT_ID,
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
describe('register', () => {
|
|
107
|
+
it('should register tool with correct parameters', () => {
|
|
108
|
+
const result = tool.register();
|
|
109
|
+
expect(mockMcpServer.registerTool).toHaveBeenCalledWith('get-build-status', expect.objectContaining({
|
|
110
|
+
title: 'Get HubSpot Projects Build Status and Errors',
|
|
111
|
+
description: expect.stringContaining('Retrieves build status and error messages for HubSpot projects'),
|
|
112
|
+
inputSchema: expect.any(Object),
|
|
113
|
+
}), expect.any(Function));
|
|
114
|
+
expect(result).toBe(mockRegisteredTool);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
describe('handler', () => {
|
|
118
|
+
const baseInput = {
|
|
119
|
+
absoluteProjectPath: TEST_PROJECT_PATH,
|
|
120
|
+
absoluteCurrentWorkingDirectory: TEST_WORKING_DIR,
|
|
121
|
+
buildId: undefined,
|
|
122
|
+
limit: 5,
|
|
123
|
+
};
|
|
124
|
+
describe('error handling', () => {
|
|
125
|
+
it('should return error when account ID cannot be determined', async () => {
|
|
126
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
|
|
127
|
+
const result = await tool.handler(baseInput);
|
|
128
|
+
expect(result).toEqual({
|
|
129
|
+
content: [
|
|
130
|
+
{
|
|
131
|
+
type: 'text',
|
|
132
|
+
text: TEST_WORKING_DIR,
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
type: 'text',
|
|
136
|
+
text: 'No account ID found. Please run `hs account auth` to configure an account, or set a default account with `hs account use <account>`',
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
});
|
|
140
|
+
expect(mockFetchProjectBuilds).not.toHaveBeenCalled();
|
|
141
|
+
});
|
|
142
|
+
it('should return error when specific build for provided buildId is not found', async () => {
|
|
143
|
+
const error = new Error('Build not found');
|
|
144
|
+
// @ts-expect-error Adding status property
|
|
145
|
+
error.status = 404;
|
|
146
|
+
mockIsHubSpotHttpError.mockReturnValue(true);
|
|
147
|
+
mockGetBuildStatus.mockRejectedValue(error);
|
|
148
|
+
const result = await tool.handler({ ...baseInput, buildId: 999 });
|
|
149
|
+
expectTextContent(result, 'Build not found');
|
|
150
|
+
});
|
|
151
|
+
it('should handle HubSpot HTTP errors', async () => {
|
|
152
|
+
const error = new Error('API Error');
|
|
153
|
+
mockIsHubSpotHttpError.mockReturnValue(true);
|
|
154
|
+
mockFetchProjectBuilds.mockRejectedValue(error);
|
|
155
|
+
const result = await tool.handler(baseInput);
|
|
156
|
+
expectTextContent(result, 'API Error');
|
|
157
|
+
});
|
|
158
|
+
it('should handle generic errors', async () => {
|
|
159
|
+
const error = new Error('Generic error');
|
|
160
|
+
mockIsHubSpotHttpError.mockReturnValue(false);
|
|
161
|
+
mockFetchProjectBuilds.mockRejectedValue(error);
|
|
162
|
+
const result = await tool.handler(baseInput);
|
|
163
|
+
expectTextContent(result, 'Generic error');
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
describe('list view (no buildId)', () => {
|
|
167
|
+
it('should return recent builds when no buildId is provided', async () => {
|
|
168
|
+
const mockBuild = createMockBuild();
|
|
169
|
+
mockFetchProjectBuilds.mockResolvedValue(
|
|
170
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
171
|
+
createBuildListResponse([mockBuild]));
|
|
172
|
+
const result = await tool.handler(baseInput);
|
|
173
|
+
expect(mockGetProjectConfig).toHaveBeenCalledWith(TEST_PROJECT_PATH);
|
|
174
|
+
expect(mockFetchProjectBuilds).toHaveBeenCalledWith(TEST_ACCOUNT_ID, TEST_PROJECT_NAME, { limit: 5 });
|
|
175
|
+
expectTextContent(result, `Recent builds for '${TEST_PROJECT_NAME}':`, 'Build #10 - FAILURE', 'The source code for this project is too large');
|
|
176
|
+
});
|
|
177
|
+
it('should return error when no builds exist', async () => {
|
|
178
|
+
mockFetchProjectBuilds.mockResolvedValue(
|
|
179
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
180
|
+
createBuildListResponse([]));
|
|
181
|
+
const result = await tool.handler(baseInput);
|
|
182
|
+
expectTextContent(result, `No builds found for project '${TEST_PROJECT_NAME}'`);
|
|
183
|
+
});
|
|
184
|
+
it('should handle successful builds', async () => {
|
|
185
|
+
const successBuild = createMockBuild({
|
|
186
|
+
buildId: 11,
|
|
187
|
+
status: 'SUCCESS',
|
|
188
|
+
buildErrorMessage: undefined,
|
|
189
|
+
subbuildStatuses: [
|
|
190
|
+
{
|
|
191
|
+
buildName: 'my-app',
|
|
192
|
+
buildType: 'APPLICATION',
|
|
193
|
+
status: 'SUCCESS',
|
|
194
|
+
errorMessage: '',
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
});
|
|
198
|
+
mockFetchProjectBuilds.mockResolvedValue(
|
|
199
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
200
|
+
createBuildListResponse([successBuild]));
|
|
201
|
+
const result = await tool.handler(baseInput);
|
|
202
|
+
expectTextContent(result, 'Build #11 - SUCCESS ✓');
|
|
203
|
+
expect(result.content[1].text).not.toContain('Error:');
|
|
204
|
+
});
|
|
205
|
+
it('should display all subbuilds (success and failure)', async () => {
|
|
206
|
+
const buildWithSubbuilds = createMockBuild({
|
|
207
|
+
subbuildStatuses: [
|
|
208
|
+
{
|
|
209
|
+
buildName: 'my-webhooks',
|
|
210
|
+
buildType: 'WEBHOOKS',
|
|
211
|
+
status: 'SUCCESS',
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
buildName: 'my-app',
|
|
215
|
+
buildType: 'APPLICATION',
|
|
216
|
+
status: 'FAILURE',
|
|
217
|
+
errorMessage: 'Duplicate UID',
|
|
218
|
+
},
|
|
219
|
+
],
|
|
220
|
+
});
|
|
221
|
+
mockFetchProjectBuilds.mockResolvedValue(
|
|
222
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
223
|
+
createBuildListResponse([buildWithSubbuilds]));
|
|
224
|
+
const result = await tool.handler(baseInput);
|
|
225
|
+
expectTextContent(result, 'Subbuilds:', '✓ my-webhooks (WEBHOOKS): SUCCESS', '⚠️ my-app (APPLICATION): FAILURE', 'Error: Duplicate UID');
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
describe('detail view (with buildId)', () => {
|
|
229
|
+
it('should return specific build details when buildId is provided', async () => {
|
|
230
|
+
const mockBuild = createMockBuild();
|
|
231
|
+
mockGetBuildStatus.mockResolvedValue(
|
|
232
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
233
|
+
createBuildDetailsResponse(mockBuild));
|
|
234
|
+
const result = await tool.handler({ ...baseInput, buildId: 10 });
|
|
235
|
+
expect(mockGetBuildStatus).toHaveBeenCalledWith(TEST_ACCOUNT_ID, TEST_PROJECT_NAME, 10);
|
|
236
|
+
expectTextContent(result, 'Build #10 Details', 'Status: FAILURE', `Platform Version: ${TEST_PLATFORM_VERSION}`, 'Build Error:');
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { GetConfigValuesTool } from '../GetConfigValuesTool.js';
|
|
2
2
|
import { getIntermediateRepresentationSchema, mapToInternalType, } from '@hubspot/project-parsing-lib';
|
|
3
|
-
import {
|
|
3
|
+
import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
|
|
4
4
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
5
5
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
6
6
|
vi.mock('@hubspot/project-parsing-lib');
|
|
7
|
-
vi.mock('
|
|
7
|
+
vi.mock('@hubspot/local-dev-lib/config');
|
|
8
8
|
vi.mock('../../../utils/toolUsageTracking');
|
|
9
9
|
vi.mock('../../../utils/feedbackTracking');
|
|
10
10
|
const mockMcpFeedbackRequest = mcpFeedbackRequest;
|
|
11
11
|
const mockGetIntermediateRepresentationSchema = getIntermediateRepresentationSchema;
|
|
12
12
|
const mockMapToInternalType = mapToInternalType;
|
|
13
|
-
const
|
|
13
|
+
const mockGetConfigDefaultAccountIfExists = getConfigDefaultAccountIfExists;
|
|
14
14
|
describe('mcp-server/tools/project/GetConfigValuesTool', () => {
|
|
15
15
|
let mockMcpServer;
|
|
16
16
|
let tool;
|
|
@@ -51,7 +51,9 @@ describe('mcp-server/tools/project/GetConfigValuesTool', () => {
|
|
|
51
51
|
absoluteCurrentWorkingDirectory: '/foo',
|
|
52
52
|
};
|
|
53
53
|
beforeEach(() => {
|
|
54
|
-
|
|
54
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue({
|
|
55
|
+
accountId: 123456789,
|
|
56
|
+
});
|
|
55
57
|
});
|
|
56
58
|
it('should return config schema when component type exists', async () => {
|
|
57
59
|
const mockSchema = {
|
|
@@ -66,7 +68,7 @@ describe('mcp-server/tools/project/GetConfigValuesTool', () => {
|
|
|
66
68
|
mockGetIntermediateRepresentationSchema.mockResolvedValue(mockSchema);
|
|
67
69
|
mockMapToInternalType.mockReturnValue('internal-card-type');
|
|
68
70
|
const result = await tool.handler(input);
|
|
69
|
-
expect(
|
|
71
|
+
expect(mockGetConfigDefaultAccountIfExists).toHaveBeenCalled();
|
|
70
72
|
expect(mockGetIntermediateRepresentationSchema).toHaveBeenCalledWith({
|
|
71
73
|
platformVersion: '2025.2',
|
|
72
74
|
projectSourceDir: '',
|
|
@@ -139,7 +141,7 @@ describe('mcp-server/tools/project/GetConfigValuesTool', () => {
|
|
|
139
141
|
});
|
|
140
142
|
});
|
|
141
143
|
it('should handle null account id', async () => {
|
|
142
|
-
|
|
144
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
|
|
143
145
|
const result = await tool.handler(input);
|
|
144
146
|
expect(result).toEqual({
|
|
145
147
|
content: [
|