github-issue-tower-defence-management 1.88.0 → 1.88.1
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/CHANGELOG.md +7 -0
- package/README.md +9 -1
- package/bin/adapter/entry-points/cli/index.js +35 -0
- package/bin/adapter/entry-points/cli/index.js.map +1 -1
- package/bin/adapter/entry-points/console/consoleDataDelivery.js +155 -0
- package/bin/adapter/entry-points/console/consoleDataDelivery.js.map +1 -0
- package/bin/adapter/entry-points/console/consoleDoneStore.js +100 -0
- package/bin/adapter/entry-points/console/consoleDoneStore.js.map +1 -0
- package/bin/adapter/entry-points/console/consoleOperationApi.js +178 -0
- package/bin/adapter/entry-points/console/consoleOperationApi.js.map +1 -0
- package/bin/adapter/entry-points/console/consoleReadApi.js +119 -0
- package/bin/adapter/entry-points/console/consoleReadApi.js.map +1 -0
- package/bin/adapter/entry-points/console/consoleServer.js +147 -3
- package/bin/adapter/entry-points/console/consoleServer.js.map +1 -1
- package/bin/domain/usecases/NotifyFinishedIssuePreparationUseCase.js +3 -0
- package/bin/domain/usecases/NotifyFinishedIssuePreparationUseCase.js.map +1 -1
- package/package.json +1 -1
- package/src/adapter/entry-points/cli/index.test.ts +94 -0
- package/src/adapter/entry-points/cli/index.ts +61 -0
- package/src/adapter/entry-points/console/consoleDataDelivery.test.ts +184 -0
- package/src/adapter/entry-points/console/consoleDataDelivery.ts +169 -0
- package/src/adapter/entry-points/console/consoleDoneStore.test.ts +98 -0
- package/src/adapter/entry-points/console/consoleDoneStore.ts +91 -0
- package/src/adapter/entry-points/console/consoleOperationApi.test.ts +444 -0
- package/src/adapter/entry-points/console/consoleOperationApi.ts +280 -0
- package/src/adapter/entry-points/console/consoleReadApi.test.ts +297 -0
- package/src/adapter/entry-points/console/consoleReadApi.ts +192 -0
- package/src/adapter/entry-points/console/consoleServer.test.ts +269 -0
- package/src/adapter/entry-points/console/consoleServer.ts +228 -4
- package/src/domain/usecases/NotifyFinishedIssuePreparationUseCase.test.ts +34 -0
- package/src/domain/usecases/NotifyFinishedIssuePreparationUseCase.ts +3 -0
- package/types/adapter/entry-points/cli/index.d.ts.map +1 -1
- package/types/adapter/entry-points/console/consoleDataDelivery.d.ts +23 -0
- package/types/adapter/entry-points/console/consoleDataDelivery.d.ts.map +1 -0
- package/types/adapter/entry-points/console/consoleDoneStore.d.ts +10 -0
- package/types/adapter/entry-points/console/consoleDoneStore.d.ts.map +1 -0
- package/types/adapter/entry-points/console/consoleOperationApi.d.ts +18 -0
- package/types/adapter/entry-points/console/consoleOperationApi.d.ts.map +1 -0
- package/types/adapter/entry-points/console/consoleReadApi.d.ts +44 -0
- package/types/adapter/entry-points/console/consoleReadApi.d.ts.map +1 -0
- package/types/adapter/entry-points/console/consoleServer.d.ts +8 -1
- package/types/adapter/entry-points/console/consoleServer.d.ts.map +1 -1
- package/types/domain/usecases/NotifyFinishedIssuePreparationUseCase.d.ts.map +1 -1
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as os from 'os';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
import { mock } from 'jest-mock-extended';
|
|
5
|
+
import { IssueRepository } from '../../../domain/usecases/adapter-interfaces/IssueRepository';
|
|
6
|
+
import { Project } from '../../../domain/entities/Project';
|
|
7
|
+
import { Issue } from '../../../domain/entities/Issue';
|
|
8
|
+
import {
|
|
9
|
+
ConsoleOperationContext,
|
|
10
|
+
handleIntmux,
|
|
11
|
+
handleReview,
|
|
12
|
+
handleTriage,
|
|
13
|
+
} from './consoleOperationApi';
|
|
14
|
+
import {
|
|
15
|
+
CONSOLE_DONE_TAB_NAMES,
|
|
16
|
+
readDoneProjectItemIds,
|
|
17
|
+
} from './consoleDoneStore';
|
|
18
|
+
|
|
19
|
+
describe('consoleOperationApi', () => {
|
|
20
|
+
let baseDir: string;
|
|
21
|
+
let issueRepository: ReturnType<typeof mock<IssueRepository>>;
|
|
22
|
+
let project: Project;
|
|
23
|
+
let context: ConsoleOperationContext;
|
|
24
|
+
|
|
25
|
+
const issue: Issue = {
|
|
26
|
+
...mock<Issue>(),
|
|
27
|
+
url: 'https://github.com/o/r/issues/1',
|
|
28
|
+
itemId: 'PVTI_loaded',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
baseDir = fs.mkdtempSync(path.join(os.tmpdir(), 'console-op-'));
|
|
33
|
+
issueRepository = mock<IssueRepository>();
|
|
34
|
+
issueRepository.get.mockResolvedValue(issue);
|
|
35
|
+
project = {
|
|
36
|
+
...mock<Project>(),
|
|
37
|
+
id: 'PVT_1',
|
|
38
|
+
status: {
|
|
39
|
+
name: 'Status',
|
|
40
|
+
fieldId: 'statusField',
|
|
41
|
+
statuses: [
|
|
42
|
+
{
|
|
43
|
+
id: 'status_aw',
|
|
44
|
+
name: 'Awaiting workspace',
|
|
45
|
+
color: 'GRAY',
|
|
46
|
+
description: '',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 'status_intmux',
|
|
50
|
+
name: 'In Tmux by human',
|
|
51
|
+
color: 'YELLOW',
|
|
52
|
+
description: '',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'status_todo',
|
|
56
|
+
name: 'Todo',
|
|
57
|
+
color: 'BLUE',
|
|
58
|
+
description: '',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
story: {
|
|
63
|
+
name: 'Story',
|
|
64
|
+
fieldId: 'storyField',
|
|
65
|
+
databaseId: 1,
|
|
66
|
+
stories: [],
|
|
67
|
+
workflowManagementStory: { id: 'wms', name: 'workflow' },
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
context = {
|
|
71
|
+
issueRepository,
|
|
72
|
+
project,
|
|
73
|
+
consoleDataOutputDir: baseDir,
|
|
74
|
+
pjcode: 'umino',
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
afterEach(() => {
|
|
79
|
+
fs.rmSync(baseDir, { recursive: true, force: true });
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const expectRecordedAcrossTabs = (projectItemId: string): void => {
|
|
83
|
+
for (const tab of CONSOLE_DONE_TAB_NAMES) {
|
|
84
|
+
expect(readDoneProjectItemIds(baseDir, 'umino', tab)).toContain(
|
|
85
|
+
projectItemId,
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
describe('handleReview', () => {
|
|
91
|
+
it('approves and sets Awaiting workspace then records done', async () => {
|
|
92
|
+
const response = await handleReview(context, {
|
|
93
|
+
action: 'approve',
|
|
94
|
+
prUrl: 'https://github.com/o/r/pull/1',
|
|
95
|
+
projectItemId: 'PVTI_a',
|
|
96
|
+
});
|
|
97
|
+
expect(response.statusCode).toBe(200);
|
|
98
|
+
expect(issueRepository.approvePullRequest).toHaveBeenCalledWith(
|
|
99
|
+
'https://github.com/o/r/pull/1',
|
|
100
|
+
);
|
|
101
|
+
expect(issueRepository.updateStatus).toHaveBeenCalledWith(
|
|
102
|
+
project,
|
|
103
|
+
{ ...issue, itemId: 'PVTI_a' },
|
|
104
|
+
'status_aw',
|
|
105
|
+
);
|
|
106
|
+
expectRecordedAcrossTabs('PVTI_a');
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('requests changes with the inline comment', async () => {
|
|
110
|
+
const response = await handleReview(context, {
|
|
111
|
+
action: 'request_changes',
|
|
112
|
+
prUrl: 'https://github.com/o/r/pull/1',
|
|
113
|
+
projectItemId: 'PVTI_b',
|
|
114
|
+
commentBody: 'please fix',
|
|
115
|
+
changedFilePath: 'src/a.ts',
|
|
116
|
+
});
|
|
117
|
+
expect(response.statusCode).toBe(200);
|
|
118
|
+
expect(
|
|
119
|
+
issueRepository.requestChangesWithInlineComment,
|
|
120
|
+
).toHaveBeenCalledWith(
|
|
121
|
+
'https://github.com/o/r/pull/1',
|
|
122
|
+
'src/a.ts',
|
|
123
|
+
'please fix',
|
|
124
|
+
);
|
|
125
|
+
expectRecordedAcrossTabs('PVTI_b');
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('rejects request_changes without a comment body', async () => {
|
|
129
|
+
const response = await handleReview(context, {
|
|
130
|
+
action: 'request_changes',
|
|
131
|
+
prUrl: 'https://github.com/o/r/pull/1',
|
|
132
|
+
projectItemId: 'PVTI_b',
|
|
133
|
+
});
|
|
134
|
+
expect(response.statusCode).toBe(400);
|
|
135
|
+
expect(
|
|
136
|
+
issueRepository.requestChangesWithInlineComment,
|
|
137
|
+
).not.toHaveBeenCalled();
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('closes a pull request and posts a comment', async () => {
|
|
141
|
+
const response = await handleReview(context, {
|
|
142
|
+
action: 'close',
|
|
143
|
+
prUrl: 'https://github.com/o/r/pull/1',
|
|
144
|
+
projectItemId: 'PVTI_c',
|
|
145
|
+
commentBody: 'closing',
|
|
146
|
+
});
|
|
147
|
+
expect(response.statusCode).toBe(200);
|
|
148
|
+
expect(issueRepository.closePullRequest).toHaveBeenCalledWith(
|
|
149
|
+
'https://github.com/o/r/pull/1',
|
|
150
|
+
);
|
|
151
|
+
expect(issueRepository.createCommentByUrl).toHaveBeenCalledWith(
|
|
152
|
+
'https://github.com/o/r/pull/1',
|
|
153
|
+
'closing',
|
|
154
|
+
);
|
|
155
|
+
expectRecordedAcrossTabs('PVTI_c');
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it('rejects an unknown review action', async () => {
|
|
159
|
+
const response = await handleReview(context, {
|
|
160
|
+
action: 'frobnicate',
|
|
161
|
+
prUrl: 'https://github.com/o/r/pull/1',
|
|
162
|
+
projectItemId: 'PVTI_c',
|
|
163
|
+
});
|
|
164
|
+
expect(response.statusCode).toBe(400);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it('rejects a missing prUrl', async () => {
|
|
168
|
+
const response = await handleReview(context, {
|
|
169
|
+
action: 'approve',
|
|
170
|
+
projectItemId: 'PVTI_c',
|
|
171
|
+
});
|
|
172
|
+
expect(response.statusCode).toBe(400);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it('rejects a missing action', async () => {
|
|
176
|
+
const response = await handleReview(context, {
|
|
177
|
+
prUrl: 'https://github.com/o/r/pull/1',
|
|
178
|
+
projectItemId: 'PVTI_c',
|
|
179
|
+
});
|
|
180
|
+
expect(response.statusCode).toBe(400);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('rejects a missing projectItemId', async () => {
|
|
184
|
+
const response = await handleReview(context, {
|
|
185
|
+
action: 'approve',
|
|
186
|
+
prUrl: 'https://github.com/o/r/pull/1',
|
|
187
|
+
});
|
|
188
|
+
expect(response.statusCode).toBe(400);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it('returns 400 when the issue cannot be loaded during approve', async () => {
|
|
192
|
+
issueRepository.get.mockResolvedValue(null);
|
|
193
|
+
const response = await handleReview(context, {
|
|
194
|
+
action: 'approve',
|
|
195
|
+
prUrl: 'https://github.com/o/r/pull/1',
|
|
196
|
+
projectItemId: 'PVTI_c',
|
|
197
|
+
});
|
|
198
|
+
expect(response.statusCode).toBe(400);
|
|
199
|
+
expect(issueRepository.updateStatus).not.toHaveBeenCalled();
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it('returns 400 when the Awaiting workspace status is absent', async () => {
|
|
203
|
+
const contextWithoutStatus: ConsoleOperationContext = {
|
|
204
|
+
...context,
|
|
205
|
+
project: {
|
|
206
|
+
...project,
|
|
207
|
+
status: { name: 'Status', fieldId: 'f', statuses: [] },
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
const response = await handleReview(contextWithoutStatus, {
|
|
211
|
+
action: 'approve',
|
|
212
|
+
prUrl: 'https://github.com/o/r/pull/1',
|
|
213
|
+
projectItemId: 'PVTI_c',
|
|
214
|
+
});
|
|
215
|
+
expect(response.statusCode).toBe(400);
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
describe('handleTriage', () => {
|
|
220
|
+
it('sets the status by name', async () => {
|
|
221
|
+
const response = await handleTriage(context, {
|
|
222
|
+
action: 'set_status',
|
|
223
|
+
issueUrl: 'https://github.com/o/r/issues/1',
|
|
224
|
+
projectItemId: 'PVTI_d',
|
|
225
|
+
statusName: 'Todo',
|
|
226
|
+
});
|
|
227
|
+
expect(response.statusCode).toBe(200);
|
|
228
|
+
expect(issueRepository.updateStatus).toHaveBeenCalledWith(
|
|
229
|
+
project,
|
|
230
|
+
{ ...issue, itemId: 'PVTI_d' },
|
|
231
|
+
'status_todo',
|
|
232
|
+
);
|
|
233
|
+
expectRecordedAcrossTabs('PVTI_d');
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
it('rejects an unknown status name', async () => {
|
|
237
|
+
const response = await handleTriage(context, {
|
|
238
|
+
action: 'set_status',
|
|
239
|
+
issueUrl: 'https://github.com/o/r/issues/1',
|
|
240
|
+
projectItemId: 'PVTI_d',
|
|
241
|
+
statusName: 'Nonexistent',
|
|
242
|
+
});
|
|
243
|
+
expect(response.statusCode).toBe(400);
|
|
244
|
+
expect(issueRepository.updateStatus).not.toHaveBeenCalled();
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it('sets the story option', async () => {
|
|
248
|
+
const response = await handleTriage(context, {
|
|
249
|
+
action: 'set_story',
|
|
250
|
+
issueUrl: 'https://github.com/o/r/issues/1',
|
|
251
|
+
projectItemId: 'PVTI_e',
|
|
252
|
+
storyOptionId: 'story_opt_1',
|
|
253
|
+
});
|
|
254
|
+
expect(response.statusCode).toBe(200);
|
|
255
|
+
expect(issueRepository.updateStory).toHaveBeenCalledWith(
|
|
256
|
+
expect.objectContaining({ id: 'PVT_1' }),
|
|
257
|
+
{ ...issue, itemId: 'PVTI_e' },
|
|
258
|
+
'story_opt_1',
|
|
259
|
+
);
|
|
260
|
+
expectRecordedAcrossTabs('PVTI_e');
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it('snoozes for one day via updateNextActionDate', async () => {
|
|
264
|
+
const response = await handleTriage(context, {
|
|
265
|
+
action: 'snooze_1day',
|
|
266
|
+
issueUrl: 'https://github.com/o/r/issues/1',
|
|
267
|
+
projectItemId: 'PVTI_f',
|
|
268
|
+
});
|
|
269
|
+
expect(response.statusCode).toBe(200);
|
|
270
|
+
expect(issueRepository.updateNextActionDate).toHaveBeenCalledTimes(1);
|
|
271
|
+
const call = issueRepository.updateNextActionDate.mock.calls[0];
|
|
272
|
+
expect(call[0]).toBe('https://github.com/o/r/issues/1');
|
|
273
|
+
expect(call[1]).toBe(project);
|
|
274
|
+
expect(call[2]).toBeInstanceOf(Date);
|
|
275
|
+
expectRecordedAcrossTabs('PVTI_f');
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
it('snoozes for one week via updateNextActionDate', async () => {
|
|
279
|
+
const response = await handleTriage(context, {
|
|
280
|
+
action: 'snooze_1week',
|
|
281
|
+
issueUrl: 'https://github.com/o/r/issues/1',
|
|
282
|
+
projectItemId: 'PVTI_g',
|
|
283
|
+
});
|
|
284
|
+
expect(response.statusCode).toBe(200);
|
|
285
|
+
expect(issueRepository.updateNextActionDate).toHaveBeenCalledTimes(1);
|
|
286
|
+
expectRecordedAcrossTabs('PVTI_g');
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
it('closes via the triage close action', async () => {
|
|
290
|
+
const response = await handleTriage(context, {
|
|
291
|
+
action: 'close',
|
|
292
|
+
issueUrl: 'https://github.com/o/r/issues/1',
|
|
293
|
+
projectItemId: 'PVTI_h',
|
|
294
|
+
commentBody: 'duplicate',
|
|
295
|
+
});
|
|
296
|
+
expect(response.statusCode).toBe(200);
|
|
297
|
+
expect(issueRepository.closePullRequest).toHaveBeenCalledWith(
|
|
298
|
+
'https://github.com/o/r/issues/1',
|
|
299
|
+
);
|
|
300
|
+
expect(issueRepository.createCommentByUrl).toHaveBeenCalledWith(
|
|
301
|
+
'https://github.com/o/r/issues/1',
|
|
302
|
+
'duplicate',
|
|
303
|
+
);
|
|
304
|
+
expectRecordedAcrossTabs('PVTI_h');
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
it('rejects an unknown triage action', async () => {
|
|
308
|
+
const response = await handleTriage(context, {
|
|
309
|
+
action: 'unknown',
|
|
310
|
+
issueUrl: 'https://github.com/o/r/issues/1',
|
|
311
|
+
projectItemId: 'PVTI_h',
|
|
312
|
+
});
|
|
313
|
+
expect(response.statusCode).toBe(400);
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
it('rejects set_status without a status name', async () => {
|
|
317
|
+
const response = await handleTriage(context, {
|
|
318
|
+
action: 'set_status',
|
|
319
|
+
issueUrl: 'https://github.com/o/r/issues/1',
|
|
320
|
+
projectItemId: 'PVTI_h',
|
|
321
|
+
});
|
|
322
|
+
expect(response.statusCode).toBe(400);
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
it('rejects set_story without a story option id', async () => {
|
|
326
|
+
const response = await handleTriage(context, {
|
|
327
|
+
action: 'set_story',
|
|
328
|
+
issueUrl: 'https://github.com/o/r/issues/1',
|
|
329
|
+
projectItemId: 'PVTI_h',
|
|
330
|
+
});
|
|
331
|
+
expect(response.statusCode).toBe(400);
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
it('rejects set_story when the project has no story field', async () => {
|
|
335
|
+
const contextWithoutStory: ConsoleOperationContext = {
|
|
336
|
+
...context,
|
|
337
|
+
project: { ...project, story: null },
|
|
338
|
+
};
|
|
339
|
+
const response = await handleTriage(contextWithoutStory, {
|
|
340
|
+
action: 'set_story',
|
|
341
|
+
issueUrl: 'https://github.com/o/r/issues/1',
|
|
342
|
+
projectItemId: 'PVTI_h',
|
|
343
|
+
storyOptionId: 'story_opt_1',
|
|
344
|
+
});
|
|
345
|
+
expect(response.statusCode).toBe(400);
|
|
346
|
+
expect(issueRepository.updateStory).not.toHaveBeenCalled();
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
it('rejects a missing issueUrl', async () => {
|
|
350
|
+
const response = await handleTriage(context, {
|
|
351
|
+
action: 'set_status',
|
|
352
|
+
projectItemId: 'PVTI_h',
|
|
353
|
+
statusName: 'Todo',
|
|
354
|
+
});
|
|
355
|
+
expect(response.statusCode).toBe(400);
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
it('returns 400 when the issue cannot be loaded for set_story', async () => {
|
|
359
|
+
issueRepository.get.mockResolvedValue(null);
|
|
360
|
+
const response = await handleTriage(context, {
|
|
361
|
+
action: 'set_story',
|
|
362
|
+
issueUrl: 'https://github.com/o/r/issues/1',
|
|
363
|
+
projectItemId: 'PVTI_h',
|
|
364
|
+
storyOptionId: 'story_opt_1',
|
|
365
|
+
});
|
|
366
|
+
expect(response.statusCode).toBe(400);
|
|
367
|
+
});
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
describe('handleIntmux', () => {
|
|
371
|
+
it('sets the In Tmux by human status and records done', async () => {
|
|
372
|
+
const response = await handleIntmux(context, {
|
|
373
|
+
action: 'set_intmux',
|
|
374
|
+
issueUrl: 'https://github.com/o/r/issues/1',
|
|
375
|
+
projectItemId: 'PVTI_i',
|
|
376
|
+
});
|
|
377
|
+
expect(response.statusCode).toBe(200);
|
|
378
|
+
expect(issueRepository.updateStatus).toHaveBeenCalledWith(
|
|
379
|
+
project,
|
|
380
|
+
{ ...issue, itemId: 'PVTI_i' },
|
|
381
|
+
'status_intmux',
|
|
382
|
+
);
|
|
383
|
+
expectRecordedAcrossTabs('PVTI_i');
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
it('rejects an unknown intmux action', async () => {
|
|
387
|
+
const response = await handleIntmux(context, {
|
|
388
|
+
action: 'unset_intmux',
|
|
389
|
+
issueUrl: 'https://github.com/o/r/issues/1',
|
|
390
|
+
projectItemId: 'PVTI_i',
|
|
391
|
+
});
|
|
392
|
+
expect(response.statusCode).toBe(400);
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
it('returns 400 when the issue cannot be loaded', async () => {
|
|
396
|
+
issueRepository.get.mockResolvedValue(null);
|
|
397
|
+
const response = await handleIntmux(context, {
|
|
398
|
+
action: 'set_intmux',
|
|
399
|
+
issueUrl: 'https://github.com/o/r/issues/1',
|
|
400
|
+
projectItemId: 'PVTI_i',
|
|
401
|
+
});
|
|
402
|
+
expect(response.statusCode).toBe(400);
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
it('rejects a missing issueUrl', async () => {
|
|
406
|
+
const response = await handleIntmux(context, {
|
|
407
|
+
action: 'set_intmux',
|
|
408
|
+
projectItemId: 'PVTI_i',
|
|
409
|
+
});
|
|
410
|
+
expect(response.statusCode).toBe(400);
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
it('rejects a missing projectItemId', async () => {
|
|
414
|
+
const response = await handleIntmux(context, {
|
|
415
|
+
action: 'set_intmux',
|
|
416
|
+
issueUrl: 'https://github.com/o/r/issues/1',
|
|
417
|
+
});
|
|
418
|
+
expect(response.statusCode).toBe(400);
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
it('rejects a missing action', async () => {
|
|
422
|
+
const response = await handleIntmux(context, {
|
|
423
|
+
issueUrl: 'https://github.com/o/r/issues/1',
|
|
424
|
+
projectItemId: 'PVTI_i',
|
|
425
|
+
});
|
|
426
|
+
expect(response.statusCode).toBe(400);
|
|
427
|
+
});
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
describe('done recording skips when storage is not configured', () => {
|
|
431
|
+
it('does not throw when consoleDataOutputDir is null', async () => {
|
|
432
|
+
const noStorageContext: ConsoleOperationContext = {
|
|
433
|
+
...context,
|
|
434
|
+
consoleDataOutputDir: null,
|
|
435
|
+
};
|
|
436
|
+
const response = await handleIntmux(noStorageContext, {
|
|
437
|
+
action: 'set_intmux',
|
|
438
|
+
issueUrl: 'https://github.com/o/r/issues/1',
|
|
439
|
+
projectItemId: 'PVTI_j',
|
|
440
|
+
});
|
|
441
|
+
expect(response.statusCode).toBe(200);
|
|
442
|
+
});
|
|
443
|
+
});
|
|
444
|
+
});
|