@heroku/mcp-server 1.0.7-alpha.1 → 1.1.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/README.md +133 -50
- package/bin/heroku-mcp-server.mjs +1 -0
- package/dist/index.js +10 -2
- package/dist/repl/heroku-cli-repl.js +44 -2
- package/dist/repl/heroku-cli-repl.spec.js +161 -0
- package/dist/resources/dev-center-resource.js +34 -0
- package/dist/resources/dev-center-resource.spec.js +19 -0
- package/dist/tools/addons.spec.js +53 -84
- package/dist/tools/ai.spec.js +38 -54
- package/dist/tools/apps.js +0 -23
- package/dist/tools/apps.spec.js +56 -120
- package/dist/tools/data.spec.js +110 -92
- package/dist/tools/logs.spec.js +17 -22
- package/dist/tools/maintenance.spec.js +34 -36
- package/dist/tools/pipelines.spec.js +88 -75
- package/dist/tools/ps.spec.js +56 -53
- package/dist/tools/spaces.spec.js +12 -19
- package/dist/tools/teams.spec.js +13 -19
- package/dist/utils/mcp-tool-mocks.spec.js +71 -0
- package/dist/utils/mcp-tool-mocks.spechelper.js +33 -0
- package/package.json +20 -9
package/dist/tools/apps.spec.js
CHANGED
|
@@ -1,30 +1,24 @@
|
|
|
1
1
|
import { expect } from 'chai';
|
|
2
2
|
import sinon from 'sinon';
|
|
3
|
-
import {
|
|
4
|
-
import { HerokuREPL } from '../repl/heroku-cli-repl.js';
|
|
5
|
-
import { listAppsOptionsSchema, getAppInfoOptionsSchema, createAppOptionsSchema, renameAppOptionsSchema, transferAppOptionsSchema, registerListAppsTool, registerGetAppInfoTool, registerCreateAppTool, registerRenameAppTool, registerTransferAppTool } from './apps.js';
|
|
3
|
+
import { listAppsOptionsSchema, getAppInfoOptionsSchema, createAppOptionsSchema, renameAppOptionsSchema, registerListAppsTool, registerGetAppInfoTool, registerCreateAppTool, registerRenameAppTool } from './apps.js';
|
|
6
4
|
import { CommandBuilder } from '../utils/command-builder.js';
|
|
7
5
|
import { TOOL_COMMAND_MAP } from '../utils/tool-commands.js';
|
|
6
|
+
import { setupMcpToolMocks } from '../utils/mcp-tool-mocks.spechelper.js';
|
|
8
7
|
describe('apps topic tools', () => {
|
|
9
8
|
describe('registerListAppsTool', () => {
|
|
10
|
-
let
|
|
11
|
-
let herokuRepl;
|
|
9
|
+
let mocks;
|
|
12
10
|
let toolCallback;
|
|
13
11
|
beforeEach(() => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
toolCallback = callback;
|
|
18
|
-
return server;
|
|
19
|
-
});
|
|
20
|
-
registerListAppsTool(server, herokuRepl);
|
|
12
|
+
mocks = setupMcpToolMocks();
|
|
13
|
+
registerListAppsTool(mocks.server, mocks.herokuRepl);
|
|
14
|
+
toolCallback = mocks.getToolCallback();
|
|
21
15
|
});
|
|
22
16
|
afterEach(() => {
|
|
23
17
|
sinon.restore();
|
|
24
18
|
});
|
|
25
19
|
it('registers the tool with correct name and schema', () => {
|
|
26
|
-
expect(server.tool.calledOnce).to.be.true;
|
|
27
|
-
const call = server.tool.getCall(0);
|
|
20
|
+
expect(mocks.server.tool.calledOnce).to.be.true;
|
|
21
|
+
const call = mocks.server.tool.getCall(0);
|
|
28
22
|
expect(call.args[0]).to.equal('list_apps');
|
|
29
23
|
expect(call.args[2]).to.deep.equal(listAppsOptionsSchema.shape);
|
|
30
24
|
});
|
|
@@ -34,9 +28,9 @@ describe('apps topic tools', () => {
|
|
|
34
28
|
'=== Collaborated Apps\n\n' +
|
|
35
29
|
'test-app2 test-team@herokumanager.com';
|
|
36
30
|
const expectedCommand = new CommandBuilder(TOOL_COMMAND_MAP.LIST_APPS).addFlags({ all: true }).build();
|
|
37
|
-
herokuRepl.executeCommand.resolves(expectedOutput);
|
|
31
|
+
mocks.herokuRepl.executeCommand.resolves(expectedOutput);
|
|
38
32
|
const result = await toolCallback({ all: true }, {});
|
|
39
|
-
expect(herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
33
|
+
expect(mocks.herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
40
34
|
expect(result).to.deep.equal({
|
|
41
35
|
content: [{ type: 'text', text: expectedOutput }]
|
|
42
36
|
});
|
|
@@ -44,9 +38,9 @@ describe('apps topic tools', () => {
|
|
|
44
38
|
it('executes command successfully', async () => {
|
|
45
39
|
const expectedOutput = '=== user@example.com Apps\n\n' + 'test-app';
|
|
46
40
|
const expectedCommand = new CommandBuilder(TOOL_COMMAND_MAP.LIST_APPS).addFlags({ json: false }).build();
|
|
47
|
-
herokuRepl.executeCommand.resolves(expectedOutput);
|
|
41
|
+
mocks.herokuRepl.executeCommand.resolves(expectedOutput);
|
|
48
42
|
const result = await toolCallback({ json: false }, {});
|
|
49
|
-
expect(herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
43
|
+
expect(mocks.herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
50
44
|
expect(result).to.deep.equal({
|
|
51
45
|
content: [{ type: 'text', text: expectedOutput }]
|
|
52
46
|
});
|
|
@@ -54,9 +48,9 @@ describe('apps topic tools', () => {
|
|
|
54
48
|
it('executes command successfully with personal flag', async () => {
|
|
55
49
|
const expectedOutput = '=== user@example.com Apps\n\n' + 'test-app';
|
|
56
50
|
const expectedCommand = new CommandBuilder(TOOL_COMMAND_MAP.LIST_APPS).addFlags({ personal: true }).build();
|
|
57
|
-
herokuRepl.executeCommand.resolves(expectedOutput);
|
|
51
|
+
mocks.herokuRepl.executeCommand.resolves(expectedOutput);
|
|
58
52
|
const result = await toolCallback({ personal: true }, {});
|
|
59
|
-
expect(herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
53
|
+
expect(mocks.herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
60
54
|
expect(result).to.deep.equal({
|
|
61
55
|
content: [{ type: 'text', text: expectedOutput }]
|
|
62
56
|
});
|
|
@@ -64,9 +58,9 @@ describe('apps topic tools', () => {
|
|
|
64
58
|
it('executes command successfully with space flag', async () => {
|
|
65
59
|
const expectedOutput = '=== Apps in space test-space\n\n' + 'test-app2\n';
|
|
66
60
|
const expectedCommand = new CommandBuilder(TOOL_COMMAND_MAP.LIST_APPS).addFlags({ space: 'test-space' }).build();
|
|
67
|
-
herokuRepl.executeCommand.resolves(expectedOutput);
|
|
61
|
+
mocks.herokuRepl.executeCommand.resolves(expectedOutput);
|
|
68
62
|
const result = await toolCallback({ space: 'test-space' }, {});
|
|
69
|
-
expect(herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
63
|
+
expect(mocks.herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
70
64
|
expect(result).to.deep.equal({
|
|
71
65
|
content: [{ type: 'text', text: expectedOutput }]
|
|
72
66
|
});
|
|
@@ -74,33 +68,28 @@ describe('apps topic tools', () => {
|
|
|
74
68
|
it('executes command successfully with team flag', async () => {
|
|
75
69
|
const expectedOutput = '=== Apps in team test-team\n\n' + 'test-app2\n';
|
|
76
70
|
const expectedCommand = new CommandBuilder(TOOL_COMMAND_MAP.LIST_APPS).addFlags({ team: 'test-team' }).build();
|
|
77
|
-
herokuRepl.executeCommand.resolves(expectedOutput);
|
|
71
|
+
mocks.herokuRepl.executeCommand.resolves(expectedOutput);
|
|
78
72
|
const result = await toolCallback({ team: 'test-team' }, {});
|
|
79
|
-
expect(herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
73
|
+
expect(mocks.herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
80
74
|
expect(result).to.deep.equal({
|
|
81
75
|
content: [{ type: 'text', text: expectedOutput }]
|
|
82
76
|
});
|
|
83
77
|
});
|
|
84
78
|
});
|
|
85
79
|
describe('registerGetAppInfoTool', () => {
|
|
86
|
-
let
|
|
87
|
-
let herokuRepl;
|
|
80
|
+
let mocks;
|
|
88
81
|
let toolCallback;
|
|
89
82
|
beforeEach(() => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
toolCallback = callback;
|
|
94
|
-
return server;
|
|
95
|
-
});
|
|
96
|
-
registerGetAppInfoTool(server, herokuRepl);
|
|
83
|
+
mocks = setupMcpToolMocks();
|
|
84
|
+
registerGetAppInfoTool(mocks.server, mocks.herokuRepl);
|
|
85
|
+
toolCallback = mocks.getToolCallback();
|
|
97
86
|
});
|
|
98
87
|
afterEach(() => {
|
|
99
88
|
sinon.restore();
|
|
100
89
|
});
|
|
101
90
|
it('registers the tool with correct name and schema', () => {
|
|
102
|
-
expect(server.tool.calledOnce).to.be.true;
|
|
103
|
-
const call = server.tool.getCall(0);
|
|
91
|
+
expect(mocks.server.tool.calledOnce).to.be.true;
|
|
92
|
+
const call = mocks.server.tool.getCall(0);
|
|
104
93
|
expect(call.args[0]).to.equal('get_app_info');
|
|
105
94
|
expect(call.args[2]).to.deep.equal(getAppInfoOptionsSchema.shape);
|
|
106
95
|
});
|
|
@@ -109,9 +98,9 @@ describe('apps topic tools', () => {
|
|
|
109
98
|
const expectedCommand = new CommandBuilder(TOOL_COMMAND_MAP.GET_APP_INFO)
|
|
110
99
|
.addFlags({ app: 'test-app', json: true })
|
|
111
100
|
.build();
|
|
112
|
-
herokuRepl.executeCommand.resolves(expectedOutput);
|
|
101
|
+
mocks.herokuRepl.executeCommand.resolves(expectedOutput);
|
|
113
102
|
const result = await toolCallback({ app: 'test-app', json: true }, {});
|
|
114
|
-
expect(herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
103
|
+
expect(mocks.herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
115
104
|
expect(result).to.deep.equal({
|
|
116
105
|
content: [{ type: 'text', text: expectedOutput }]
|
|
117
106
|
});
|
|
@@ -119,33 +108,28 @@ describe('apps topic tools', () => {
|
|
|
119
108
|
it('executes command successfully without json flag', async () => {
|
|
120
109
|
const expectedOutput = '=== test-app\n\n' + 'Addons: heroku-postgresql:essential-0\n' + 'Stack: heroku-24';
|
|
121
110
|
const expectedCommand = new CommandBuilder(TOOL_COMMAND_MAP.GET_APP_INFO).addFlags({ app: 'test-app' }).build();
|
|
122
|
-
herokuRepl.executeCommand.resolves(expectedOutput);
|
|
111
|
+
mocks.herokuRepl.executeCommand.resolves(expectedOutput);
|
|
123
112
|
const result = await toolCallback({ app: 'test-app' }, {});
|
|
124
|
-
expect(herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
113
|
+
expect(mocks.herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
125
114
|
expect(result).to.deep.equal({
|
|
126
115
|
content: [{ type: 'text', text: expectedOutput }]
|
|
127
116
|
});
|
|
128
117
|
});
|
|
129
118
|
});
|
|
130
119
|
describe('registerCreateAppTool', () => {
|
|
131
|
-
let
|
|
132
|
-
let herokuRepl;
|
|
120
|
+
let mocks;
|
|
133
121
|
let toolCallback;
|
|
134
122
|
beforeEach(() => {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
toolCallback = callback;
|
|
139
|
-
return server;
|
|
140
|
-
});
|
|
141
|
-
registerCreateAppTool(server, herokuRepl);
|
|
123
|
+
mocks = setupMcpToolMocks();
|
|
124
|
+
registerCreateAppTool(mocks.server, mocks.herokuRepl);
|
|
125
|
+
toolCallback = mocks.getToolCallback();
|
|
142
126
|
});
|
|
143
127
|
afterEach(() => {
|
|
144
128
|
sinon.restore();
|
|
145
129
|
});
|
|
146
130
|
it('registers the tool with correct name and schema', () => {
|
|
147
|
-
expect(server.tool.calledOnce).to.be.true;
|
|
148
|
-
const call = server.tool.getCall(0);
|
|
131
|
+
expect(mocks.server.tool.calledOnce).to.be.true;
|
|
132
|
+
const call = mocks.server.tool.getCall(0);
|
|
149
133
|
expect(call.args[0]).to.equal('create_app');
|
|
150
134
|
expect(call.args[2]).to.deep.equal(createAppOptionsSchema.shape);
|
|
151
135
|
});
|
|
@@ -155,9 +139,9 @@ describe('apps topic tools', () => {
|
|
|
155
139
|
const expectedCommand = new CommandBuilder(TOOL_COMMAND_MAP.CREATE_APP)
|
|
156
140
|
.addPositionalArguments({ app: 'test-app' })
|
|
157
141
|
.build();
|
|
158
|
-
herokuRepl.executeCommand.resolves(expectedOutput);
|
|
142
|
+
mocks.herokuRepl.executeCommand.resolves(expectedOutput);
|
|
159
143
|
const result = await toolCallback({ app: 'test-app' }, {});
|
|
160
|
-
expect(herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
144
|
+
expect(mocks.herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
161
145
|
expect(result).to.deep.equal({
|
|
162
146
|
content: [{ type: 'text', text: expectedOutput }]
|
|
163
147
|
});
|
|
@@ -169,9 +153,9 @@ describe('apps topic tools', () => {
|
|
|
169
153
|
.addPositionalArguments({ app: 'test-app' })
|
|
170
154
|
.addFlags({ space: 'test-space' })
|
|
171
155
|
.build();
|
|
172
|
-
herokuRepl.executeCommand.resolves(expectedOutput);
|
|
156
|
+
mocks.herokuRepl.executeCommand.resolves(expectedOutput);
|
|
173
157
|
const result = await toolCallback({ app: 'test-app', space: 'test-space' }, {});
|
|
174
|
-
expect(herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
158
|
+
expect(mocks.herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
175
159
|
expect(result).to.deep.equal({
|
|
176
160
|
content: [{ type: 'text', text: expectedOutput }]
|
|
177
161
|
});
|
|
@@ -183,9 +167,9 @@ describe('apps topic tools', () => {
|
|
|
183
167
|
.addPositionalArguments({ app: 'test-app' })
|
|
184
168
|
.addFlags({ team: 'test-team' })
|
|
185
169
|
.build();
|
|
186
|
-
herokuRepl.executeCommand.resolves(expectedOutput);
|
|
170
|
+
mocks.herokuRepl.executeCommand.resolves(expectedOutput);
|
|
187
171
|
const result = await toolCallback({ app: 'test-app', team: 'test-team' }, {});
|
|
188
|
-
expect(herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
172
|
+
expect(mocks.herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
189
173
|
expect(result).to.deep.equal({
|
|
190
174
|
content: [{ type: 'text', text: expectedOutput }]
|
|
191
175
|
});
|
|
@@ -194,33 +178,28 @@ describe('apps topic tools', () => {
|
|
|
194
178
|
const expectedOutput = 'Creating frozen-badlands-12345... done\n' +
|
|
195
179
|
'https://frozen-badlands-89ae2afb35d.herokuapp.com/ | https://git.heroku.com/frozen-badlands.git\n';
|
|
196
180
|
const expectedCommand = new CommandBuilder(TOOL_COMMAND_MAP.CREATE_APP).build();
|
|
197
|
-
herokuRepl.executeCommand.resolves(expectedOutput);
|
|
181
|
+
mocks.herokuRepl.executeCommand.resolves(expectedOutput);
|
|
198
182
|
const result = await toolCallback({}, {});
|
|
199
|
-
expect(herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
183
|
+
expect(mocks.herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
200
184
|
expect(result).to.deep.equal({
|
|
201
185
|
content: [{ type: 'text', text: expectedOutput }]
|
|
202
186
|
});
|
|
203
187
|
});
|
|
204
188
|
});
|
|
205
189
|
describe('registerRenameAppTool', () => {
|
|
206
|
-
let
|
|
207
|
-
let herokuRepl;
|
|
190
|
+
let mocks;
|
|
208
191
|
let toolCallback;
|
|
209
192
|
beforeEach(() => {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
toolCallback = callback;
|
|
214
|
-
return server;
|
|
215
|
-
});
|
|
216
|
-
registerRenameAppTool(server, herokuRepl);
|
|
193
|
+
mocks = setupMcpToolMocks();
|
|
194
|
+
registerRenameAppTool(mocks.server, mocks.herokuRepl);
|
|
195
|
+
toolCallback = mocks.getToolCallback();
|
|
217
196
|
});
|
|
218
197
|
afterEach(() => {
|
|
219
198
|
sinon.restore();
|
|
220
199
|
});
|
|
221
200
|
it('registers the tool with correct name and schema', () => {
|
|
222
|
-
expect(server.tool.calledOnce).to.be.true;
|
|
223
|
-
const call = server.tool.getCall(0);
|
|
201
|
+
expect(mocks.server.tool.calledOnce).to.be.true;
|
|
202
|
+
const call = mocks.server.tool.getCall(0);
|
|
224
203
|
expect(call.args[0]).to.equal('rename_app');
|
|
225
204
|
expect(call.args[2]).to.deep.equal(renameAppOptionsSchema.shape);
|
|
226
205
|
});
|
|
@@ -231,45 +210,9 @@ describe('apps topic tools', () => {
|
|
|
231
210
|
.addPositionalArguments({ newName: 'test-app-2' })
|
|
232
211
|
.addFlags({ app: 'test-app' })
|
|
233
212
|
.build();
|
|
234
|
-
herokuRepl.executeCommand.resolves(expectedOutput);
|
|
213
|
+
mocks.herokuRepl.executeCommand.resolves(expectedOutput);
|
|
235
214
|
const result = await toolCallback({ app: 'test-app', newName: 'test-app-2' }, {});
|
|
236
|
-
expect(herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
237
|
-
expect(result).to.deep.equal({
|
|
238
|
-
content: [{ type: 'text', text: expectedOutput }]
|
|
239
|
-
});
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
|
-
describe('registerTransferAppTool', () => {
|
|
243
|
-
let server;
|
|
244
|
-
let herokuRepl;
|
|
245
|
-
let toolCallback;
|
|
246
|
-
beforeEach(() => {
|
|
247
|
-
server = sinon.createStubInstance(McpServer);
|
|
248
|
-
herokuRepl = sinon.createStubInstance(HerokuREPL);
|
|
249
|
-
server.tool.callsFake((_name, _description, _schema, callback) => {
|
|
250
|
-
toolCallback = callback;
|
|
251
|
-
return server;
|
|
252
|
-
});
|
|
253
|
-
registerTransferAppTool(server, herokuRepl);
|
|
254
|
-
});
|
|
255
|
-
afterEach(() => {
|
|
256
|
-
sinon.restore();
|
|
257
|
-
});
|
|
258
|
-
it('registers the tool with correct name and schema', () => {
|
|
259
|
-
expect(server.tool.calledOnce).to.be.true;
|
|
260
|
-
const call = server.tool.getCall(0);
|
|
261
|
-
expect(call.args[0]).to.equal('transfer_app');
|
|
262
|
-
expect(call.args[2]).to.deep.equal(transferAppOptionsSchema.shape);
|
|
263
|
-
});
|
|
264
|
-
it('executes command successfully', async () => {
|
|
265
|
-
const expectedOutput = 'Initiating transfer of test-app to user@example.com... email sent\n';
|
|
266
|
-
const expectedCommand = new CommandBuilder(TOOL_COMMAND_MAP.TRANSFER_APP)
|
|
267
|
-
.addFlags({ app: 'test-app' })
|
|
268
|
-
.addPositionalArguments({ recipient: 'user@example.com' })
|
|
269
|
-
.build();
|
|
270
|
-
herokuRepl.executeCommand.resolves(expectedOutput);
|
|
271
|
-
const result = await toolCallback({ app: 'test-app', recipient: 'user@example.com' }, {});
|
|
272
|
-
expect(herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
215
|
+
expect(mocks.herokuRepl.executeCommand.calledOnceWith(expectedCommand)).to.be.true;
|
|
273
216
|
expect(result).to.deep.equal({
|
|
274
217
|
content: [{ type: 'text', text: expectedOutput }]
|
|
275
218
|
});
|
|
@@ -277,33 +220,26 @@ describe('apps topic tools', () => {
|
|
|
277
220
|
});
|
|
278
221
|
// Common error handling test for all tools
|
|
279
222
|
describe('error handling', () => {
|
|
280
|
-
let
|
|
281
|
-
let herokuRepl;
|
|
282
|
-
let toolCallback;
|
|
223
|
+
let mocks;
|
|
283
224
|
beforeEach(() => {
|
|
284
|
-
|
|
285
|
-
herokuRepl = sinon.createStubInstance(HerokuREPL);
|
|
286
|
-
server.tool.callsFake((_name, _description, _schema, callback) => {
|
|
287
|
-
toolCallback = callback;
|
|
288
|
-
return server;
|
|
289
|
-
});
|
|
225
|
+
mocks = setupMcpToolMocks();
|
|
290
226
|
});
|
|
291
227
|
afterEach(() => {
|
|
292
228
|
sinon.restore();
|
|
293
229
|
});
|
|
294
230
|
it('handles CLI errors properly for all tools', async () => {
|
|
295
231
|
const expectedOutput = '<<<BEGIN RESULTS>>>\n<<<ERROR>>>API error<<<END ERROR>>><<<END RESULTS>>>';
|
|
296
|
-
herokuRepl.executeCommand.resolves(expectedOutput);
|
|
297
232
|
// Test error handling for each tool
|
|
298
233
|
const tools = [
|
|
299
234
|
{ register: registerListAppsTool, options: {} },
|
|
300
235
|
{ register: registerGetAppInfoTool, options: { app: 'test-app' } },
|
|
301
236
|
{ register: registerCreateAppTool, options: { app: 'test-app' } },
|
|
302
|
-
{ register: registerRenameAppTool, options: { app: 'old-app', newName: 'new-app' } }
|
|
303
|
-
{ register: registerTransferAppTool, options: { app: 'test-app', recipient: 'user@example.com' } }
|
|
237
|
+
{ register: registerRenameAppTool, options: { app: 'old-app', newName: 'new-app' } }
|
|
304
238
|
];
|
|
305
239
|
for (const tool of tools) {
|
|
306
|
-
|
|
240
|
+
mocks.herokuRepl.executeCommand.resolves(expectedOutput);
|
|
241
|
+
tool.register(mocks.server, mocks.herokuRepl);
|
|
242
|
+
const toolCallback = mocks.getToolCallback();
|
|
307
243
|
const result = await toolCallback(tool.options, {});
|
|
308
244
|
expect(result).to.deep.equal({
|
|
309
245
|
isError: true,
|