github-issue-tower-defence-management 1.146.0 → 1.146.2
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 +23 -9
- package/README.md +1 -1
- package/bin/adapter/entry-points/cli/index.js +29 -7
- package/bin/adapter/entry-points/cli/index.js.map +1 -1
- package/bin/adapter/entry-points/cli/projectConfig.js +3 -0
- package/bin/adapter/entry-points/cli/projectConfig.js.map +1 -1
- package/bin/adapter/entry-points/console/consoleGithubTokenResolver.js +41 -0
- package/bin/adapter/entry-points/console/consoleGithubTokenResolver.js.map +1 -0
- package/bin/adapter/entry-points/console/consoleOperationApi.js +34 -16
- package/bin/adapter/entry-points/console/consoleOperationApi.js.map +1 -1
- package/bin/adapter/entry-points/console/ensureConsoleRunning.js +6 -1
- package/bin/adapter/entry-points/console/ensureConsoleRunning.js.map +1 -1
- package/bin/adapter/entry-points/console/webServer.js +3 -4
- package/bin/adapter/entry-points/console/webServer.js.map +1 -1
- package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js +3 -1
- package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js.map +1 -1
- package/bin/adapter/repositories/GraphqlProjectRepository.js +75 -4
- package/bin/adapter/repositories/GraphqlProjectRepository.js.map +1 -1
- package/bin/adapter/repositories/utils.js +2 -4
- package/bin/adapter/repositories/utils.js.map +1 -1
- package/bin/domain/entities/ProjectFieldName.js +6 -0
- package/bin/domain/entities/ProjectFieldName.js.map +1 -0
- package/bin/domain/entities/RequiredProjectField.js +47 -0
- package/bin/domain/entities/RequiredProjectField.js.map +1 -0
- package/bin/domain/usecases/HandleScheduledEventUseCase.js +5 -1
- package/bin/domain/usecases/HandleScheduledEventUseCase.js.map +1 -1
- package/bin/domain/usecases/ProjectRequiredFieldCreateUseCase.js +25 -0
- package/bin/domain/usecases/ProjectRequiredFieldCreateUseCase.js.map +1 -0
- package/bin/domain/usecases/SetupTowerDefenceProjectUseCase.js +6 -1
- package/bin/domain/usecases/SetupTowerDefenceProjectUseCase.js.map +1 -1
- package/bin/domain/usecases/dashboard/DashboardProjectCode.js +17 -13
- package/bin/domain/usecases/dashboard/DashboardProjectCode.js.map +1 -1
- package/package.json +1 -1
- package/src/adapter/entry-points/cli/index.test.ts +62 -2
- package/src/adapter/entry-points/cli/index.ts +58 -11
- package/src/adapter/entry-points/cli/projectConfig.ts +8 -0
- package/src/adapter/entry-points/console/consoleDataDelivery.test.ts +37 -39
- package/src/adapter/entry-points/console/consoleDoneStore.test.ts +33 -33
- package/src/adapter/entry-points/console/consoleGithubTokenResolver.test.ts +135 -0
- package/src/adapter/entry-points/console/consoleGithubTokenResolver.ts +55 -0
- package/src/adapter/entry-points/console/consoleItemUrlLookup.test.ts +6 -6
- package/src/adapter/entry-points/console/consoleOperationApi.test.ts +92 -70
- package/src/adapter/entry-points/console/consoleOperationApi.ts +51 -44
- package/src/adapter/entry-points/console/consoleProjectResolver.test.ts +35 -35
- package/src/adapter/entry-points/console/dashboardComposeService.test.ts +28 -28
- package/src/adapter/entry-points/console/dashboardEmitterComposerKey.test.ts +26 -20
- package/src/adapter/entry-points/console/ensureConsoleRunning.test.ts +19 -2
- package/src/adapter/entry-points/console/ensureConsoleRunning.ts +8 -0
- package/src/adapter/entry-points/console/ui/e2e/consoleScenario.spec.ts +1 -1
- package/src/adapter/entry-points/console/ui/e2e/consoleTestHarness.ts +1 -1
- package/src/adapter/entry-points/console/ui/src/features/console/components/layout/ConsoleTabList.stories.tsx +2 -2
- package/src/adapter/entry-points/console/ui/src/features/console/components/layout/ConsoleTabList.test.tsx +3 -3
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleNavigation.test.ts +19 -31
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOperations.test.ts +24 -32
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOverlay.test.ts +6 -6
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsolePjcode.test.ts +4 -4
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleTabData.test.ts +8 -8
- package/src/adapter/entry-points/console/ui/src/features/console/lib/consoleApi.test.ts +5 -5
- package/src/adapter/entry-points/console/ui/src/features/console/logic/overlay.test.ts +1 -1
- package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsolePage.test.tsx +13 -13
- package/src/adapter/entry-points/console/webServer.test.ts +55 -52
- package/src/adapter/entry-points/console/webServer.ts +5 -4
- package/src/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.test.ts +2 -2
- package/src/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.ts +4 -0
- package/src/adapter/entry-points/handlers/dashboardRowWriter.test.ts +5 -5
- package/src/adapter/entry-points/handlers/inTmuxByHumanDataWriter.test.ts +5 -5
- package/src/adapter/repositories/GraphqlProjectRepository.ts +110 -4
- package/src/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.test.ts +1 -1
- package/src/adapter/repositories/utils.ts +3 -3
- package/src/domain/entities/ProjectFieldName.ts +2 -0
- package/src/domain/entities/RequiredProjectField.ts +64 -0
- package/src/domain/usecases/HandleScheduledEventUseCase.test.ts +4 -0
- package/src/domain/usecases/HandleScheduledEventUseCase.ts +5 -0
- package/src/domain/usecases/NotifySilentLiveSessionsUseCase.test.ts +3 -3
- package/src/domain/usecases/ProjectRequiredFieldCreateUseCase.test.ts +159 -0
- package/src/domain/usecases/ProjectRequiredFieldCreateUseCase.ts +32 -0
- package/src/domain/usecases/SetWorkflowManagementIssueToStoryUseCase.test.ts +19 -19
- package/src/domain/usecases/SetupTowerDefenceProjectUseCase.test.ts +24 -14
- package/src/domain/usecases/SetupTowerDefenceProjectUseCase.ts +10 -1
- package/src/domain/usecases/adapter-interfaces/ProjectRepository.ts +6 -0
- package/src/domain/usecases/dashboard/ComposeDashboardUseCase.test.ts +28 -28
- package/src/domain/usecases/dashboard/DashboardProjectCode.test.ts +21 -21
- package/src/domain/usecases/dashboard/DashboardProjectCode.ts +21 -15
- package/types/adapter/entry-points/cli/index.d.ts.map +1 -1
- package/types/adapter/entry-points/cli/projectConfig.d.ts +1 -0
- package/types/adapter/entry-points/cli/projectConfig.d.ts.map +1 -1
- package/types/adapter/entry-points/console/consoleGithubTokenResolver.d.ts +6 -0
- package/types/adapter/entry-points/console/consoleGithubTokenResolver.d.ts.map +1 -0
- package/types/adapter/entry-points/console/consoleOperationApi.d.ts +2 -1
- package/types/adapter/entry-points/console/consoleOperationApi.d.ts.map +1 -1
- package/types/adapter/entry-points/console/ensureConsoleRunning.d.ts +1 -1
- package/types/adapter/entry-points/console/ensureConsoleRunning.d.ts.map +1 -1
- package/types/adapter/entry-points/console/webServer.d.ts +2 -2
- package/types/adapter/entry-points/console/webServer.d.ts.map +1 -1
- package/types/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.d.ts.map +1 -1
- package/types/adapter/repositories/GraphqlProjectRepository.d.ts +4 -1
- package/types/adapter/repositories/GraphqlProjectRepository.d.ts.map +1 -1
- package/types/adapter/repositories/utils.d.ts.map +1 -1
- package/types/domain/entities/ProjectFieldName.d.ts +2 -0
- package/types/domain/entities/ProjectFieldName.d.ts.map +1 -0
- package/types/domain/entities/RequiredProjectField.d.ts +13 -0
- package/types/domain/entities/RequiredProjectField.d.ts.map +1 -0
- package/types/domain/usecases/HandleScheduledEventUseCase.d.ts +3 -1
- package/types/domain/usecases/HandleScheduledEventUseCase.d.ts.map +1 -1
- package/types/domain/usecases/ProjectRequiredFieldCreateUseCase.d.ts +10 -0
- package/types/domain/usecases/ProjectRequiredFieldCreateUseCase.d.ts.map +1 -0
- package/types/domain/usecases/SetupTowerDefenceProjectUseCase.d.ts.map +1 -1
- package/types/domain/usecases/adapter-interfaces/ProjectRepository.d.ts +3 -0
- package/types/domain/usecases/adapter-interfaces/ProjectRepository.d.ts.map +1 -1
- package/types/domain/usecases/dashboard/DashboardProjectCode.d.ts +2 -2
- package/types/domain/usecases/dashboard/DashboardProjectCode.d.ts.map +1 -1
|
@@ -72,10 +72,10 @@ describe('consoleOperationApi', () => {
|
|
|
72
72
|
},
|
|
73
73
|
};
|
|
74
74
|
context = {
|
|
75
|
-
issueRepository,
|
|
75
|
+
resolveIssueRepository: () => issueRepository,
|
|
76
76
|
resolveProject: async (pjcode: string) =>
|
|
77
|
-
pjcode === '
|
|
78
|
-
isPjcodeConfigured: (pjcode: string) => pjcode === '
|
|
77
|
+
pjcode === 'acme' ? { pjcode, project } : null,
|
|
78
|
+
isPjcodeConfigured: (pjcode: string) => pjcode === 'acme',
|
|
79
79
|
consoleDataOutputDir: baseDir,
|
|
80
80
|
issueAttachmentRepository: null,
|
|
81
81
|
};
|
|
@@ -84,10 +84,10 @@ describe('consoleOperationApi', () => {
|
|
|
84
84
|
const contextForProject = (
|
|
85
85
|
nextProject: Project,
|
|
86
86
|
): ConsoleOperationContext => ({
|
|
87
|
-
issueRepository,
|
|
87
|
+
resolveIssueRepository: () => issueRepository,
|
|
88
88
|
resolveProject: async (pjcode: string) =>
|
|
89
|
-
pjcode === '
|
|
90
|
-
isPjcodeConfigured: (pjcode: string) => pjcode === '
|
|
89
|
+
pjcode === 'acme' ? { pjcode, project: nextProject } : null,
|
|
90
|
+
isPjcodeConfigured: (pjcode: string) => pjcode === 'acme',
|
|
91
91
|
consoleDataOutputDir: baseDir,
|
|
92
92
|
issueAttachmentRepository: null,
|
|
93
93
|
});
|
|
@@ -98,7 +98,7 @@ describe('consoleOperationApi', () => {
|
|
|
98
98
|
|
|
99
99
|
const expectRecordedAcrossTabs = (projectItemId: string): void => {
|
|
100
100
|
for (const tab of CONSOLE_DONE_TAB_NAMES) {
|
|
101
|
-
expect(readDoneProjectItemIds(baseDir, '
|
|
101
|
+
expect(readDoneProjectItemIds(baseDir, 'acme', tab)).toContain(
|
|
102
102
|
projectItemId,
|
|
103
103
|
);
|
|
104
104
|
}
|
|
@@ -107,7 +107,7 @@ describe('consoleOperationApi', () => {
|
|
|
107
107
|
describe('handleReview', () => {
|
|
108
108
|
it('approves and sets Awaiting workspace then records done', async () => {
|
|
109
109
|
const response = await handleReview(context, {
|
|
110
|
-
pjcode: '
|
|
110
|
+
pjcode: 'acme',
|
|
111
111
|
action: 'approve',
|
|
112
112
|
prUrl: 'https://github.com/o/r/pull/1',
|
|
113
113
|
projectItemId: 'PVTI_a',
|
|
@@ -128,9 +128,31 @@ describe('consoleOperationApi', () => {
|
|
|
128
128
|
expectRecordedAcrossTabs('PVTI_a');
|
|
129
129
|
});
|
|
130
130
|
|
|
131
|
+
it('resolves the issue repository from the url of the operated pull request', async () => {
|
|
132
|
+
const resolvedUrls: string[] = [];
|
|
133
|
+
const contextRecordingResolvedUrls: ConsoleOperationContext = {
|
|
134
|
+
...context,
|
|
135
|
+
resolveIssueRepository: (issueOrPullRequestUrl: string) => {
|
|
136
|
+
resolvedUrls.push(issueOrPullRequestUrl);
|
|
137
|
+
return issueRepository;
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
await handleReview(contextRecordingResolvedUrls, {
|
|
142
|
+
pjcode: 'acme',
|
|
143
|
+
action: 'approve',
|
|
144
|
+
prUrl: 'https://github.com/meta-site/hr-audit-mock/pull/178',
|
|
145
|
+
projectItemId: 'PVTI_resolver',
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
expect(resolvedUrls).toContain(
|
|
149
|
+
'https://github.com/meta-site/hr-audit-mock/pull/178',
|
|
150
|
+
);
|
|
151
|
+
});
|
|
152
|
+
|
|
131
153
|
it('requests changes with the inline comment anchored to a line and side', async () => {
|
|
132
154
|
const response = await handleReview(context, {
|
|
133
|
-
pjcode: '
|
|
155
|
+
pjcode: 'acme',
|
|
134
156
|
action: 'request_changes',
|
|
135
157
|
prUrl: 'https://github.com/o/r/pull/1',
|
|
136
158
|
projectItemId: 'PVTI_b',
|
|
@@ -156,7 +178,7 @@ describe('consoleOperationApi', () => {
|
|
|
156
178
|
|
|
157
179
|
it('requests changes without a line anchor when line and side are missing', async () => {
|
|
158
180
|
const response = await handleReview(context, {
|
|
159
|
-
pjcode: '
|
|
181
|
+
pjcode: 'acme',
|
|
160
182
|
action: 'request_changes',
|
|
161
183
|
prUrl: 'https://github.com/o/r/pull/1',
|
|
162
184
|
projectItemId: 'PVTI_b',
|
|
@@ -177,7 +199,7 @@ describe('consoleOperationApi', () => {
|
|
|
177
199
|
|
|
178
200
|
it('rejects request_changes without a comment body', async () => {
|
|
179
201
|
const response = await handleReview(context, {
|
|
180
|
-
pjcode: '
|
|
202
|
+
pjcode: 'acme',
|
|
181
203
|
action: 'request_changes',
|
|
182
204
|
prUrl: 'https://github.com/o/r/pull/1',
|
|
183
205
|
projectItemId: 'PVTI_b',
|
|
@@ -190,7 +212,7 @@ describe('consoleOperationApi', () => {
|
|
|
190
212
|
|
|
191
213
|
it('closes a pull request and posts a comment', async () => {
|
|
192
214
|
const response = await handleReview(context, {
|
|
193
|
-
pjcode: '
|
|
215
|
+
pjcode: 'acme',
|
|
194
216
|
action: 'close',
|
|
195
217
|
prUrl: 'https://github.com/o/r/pull/1',
|
|
196
218
|
projectItemId: 'PVTI_c',
|
|
@@ -209,7 +231,7 @@ describe('consoleOperationApi', () => {
|
|
|
209
231
|
|
|
210
232
|
it('rejects an unknown review action', async () => {
|
|
211
233
|
const response = await handleReview(context, {
|
|
212
|
-
pjcode: '
|
|
234
|
+
pjcode: 'acme',
|
|
213
235
|
action: 'frobnicate',
|
|
214
236
|
prUrl: 'https://github.com/o/r/pull/1',
|
|
215
237
|
projectItemId: 'PVTI_c',
|
|
@@ -219,7 +241,7 @@ describe('consoleOperationApi', () => {
|
|
|
219
241
|
|
|
220
242
|
it('rejects a missing prUrl', async () => {
|
|
221
243
|
const response = await handleReview(context, {
|
|
222
|
-
pjcode: '
|
|
244
|
+
pjcode: 'acme',
|
|
223
245
|
action: 'approve',
|
|
224
246
|
projectItemId: 'PVTI_c',
|
|
225
247
|
});
|
|
@@ -228,7 +250,7 @@ describe('consoleOperationApi', () => {
|
|
|
228
250
|
|
|
229
251
|
it('rejects a missing action', async () => {
|
|
230
252
|
const response = await handleReview(context, {
|
|
231
|
-
pjcode: '
|
|
253
|
+
pjcode: 'acme',
|
|
232
254
|
prUrl: 'https://github.com/o/r/pull/1',
|
|
233
255
|
projectItemId: 'PVTI_c',
|
|
234
256
|
});
|
|
@@ -237,7 +259,7 @@ describe('consoleOperationApi', () => {
|
|
|
237
259
|
|
|
238
260
|
it('rejects a missing projectItemId', async () => {
|
|
239
261
|
const response = await handleReview(context, {
|
|
240
|
-
pjcode: '
|
|
262
|
+
pjcode: 'acme',
|
|
241
263
|
action: 'approve',
|
|
242
264
|
prUrl: 'https://github.com/o/r/pull/1',
|
|
243
265
|
});
|
|
@@ -247,7 +269,7 @@ describe('consoleOperationApi', () => {
|
|
|
247
269
|
it('approves using the request project item id without a GraphQL item fetch', async () => {
|
|
248
270
|
issueRepository.get.mockResolvedValue(null);
|
|
249
271
|
const response = await handleReview(context, {
|
|
250
|
-
pjcode: '
|
|
272
|
+
pjcode: 'acme',
|
|
251
273
|
action: 'approve',
|
|
252
274
|
prUrl: 'https://github.com/o/r/pull/1',
|
|
253
275
|
projectItemId: 'PVTI_c',
|
|
@@ -267,7 +289,7 @@ describe('consoleOperationApi', () => {
|
|
|
267
289
|
status: { name: 'Status', fieldId: 'f', statuses: [] },
|
|
268
290
|
});
|
|
269
291
|
const response = await handleReview(contextWithoutStatus, {
|
|
270
|
-
pjcode: '
|
|
292
|
+
pjcode: 'acme',
|
|
271
293
|
action: 'approve',
|
|
272
294
|
prUrl: 'https://github.com/o/r/pull/1',
|
|
273
295
|
projectItemId: 'PVTI_c',
|
|
@@ -279,7 +301,7 @@ describe('consoleOperationApi', () => {
|
|
|
279
301
|
describe('handleTriage', () => {
|
|
280
302
|
it('sets the status by name', async () => {
|
|
281
303
|
const response = await handleTriage(context, {
|
|
282
|
-
pjcode: '
|
|
304
|
+
pjcode: 'acme',
|
|
283
305
|
action: 'set_status',
|
|
284
306
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
285
307
|
projectItemId: 'PVTI_d',
|
|
@@ -300,7 +322,7 @@ describe('consoleOperationApi', () => {
|
|
|
300
322
|
|
|
301
323
|
it('rejects an unknown status name', async () => {
|
|
302
324
|
const response = await handleTriage(context, {
|
|
303
|
-
pjcode: '
|
|
325
|
+
pjcode: 'acme',
|
|
304
326
|
action: 'set_status',
|
|
305
327
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
306
328
|
projectItemId: 'PVTI_d',
|
|
@@ -312,7 +334,7 @@ describe('consoleOperationApi', () => {
|
|
|
312
334
|
|
|
313
335
|
it('sets the story option', async () => {
|
|
314
336
|
const response = await handleTriage(context, {
|
|
315
|
-
pjcode: '
|
|
337
|
+
pjcode: 'acme',
|
|
316
338
|
action: 'set_story',
|
|
317
339
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
318
340
|
projectItemId: 'PVTI_e',
|
|
@@ -330,7 +352,7 @@ describe('consoleOperationApi', () => {
|
|
|
330
352
|
|
|
331
353
|
it('snoozes for one day via updateNextActionDate', async () => {
|
|
332
354
|
const response = await handleTriage(context, {
|
|
333
|
-
pjcode: '
|
|
355
|
+
pjcode: 'acme',
|
|
334
356
|
action: 'snooze_1day',
|
|
335
357
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
336
358
|
projectItemId: 'PVTI_f',
|
|
@@ -346,7 +368,7 @@ describe('consoleOperationApi', () => {
|
|
|
346
368
|
|
|
347
369
|
it('snoozes for one week via updateNextActionDate', async () => {
|
|
348
370
|
const response = await handleTriage(context, {
|
|
349
|
-
pjcode: '
|
|
371
|
+
pjcode: 'acme',
|
|
350
372
|
action: 'snooze_1week',
|
|
351
373
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
352
374
|
projectItemId: 'PVTI_g',
|
|
@@ -358,7 +380,7 @@ describe('consoleOperationApi', () => {
|
|
|
358
380
|
|
|
359
381
|
it('closes an issue as completed via the triage close action', async () => {
|
|
360
382
|
const response = await handleTriage(context, {
|
|
361
|
-
pjcode: '
|
|
383
|
+
pjcode: 'acme',
|
|
362
384
|
action: 'close',
|
|
363
385
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
364
386
|
projectItemId: 'PVTI_h',
|
|
@@ -378,7 +400,7 @@ describe('consoleOperationApi', () => {
|
|
|
378
400
|
|
|
379
401
|
it('closes an issue as not planned via the triage close_not_planned action', async () => {
|
|
380
402
|
const response = await handleTriage(context, {
|
|
381
|
-
pjcode: '
|
|
403
|
+
pjcode: 'acme',
|
|
382
404
|
action: 'close_not_planned',
|
|
383
405
|
issueUrl: 'https://github.com/o/r/issues/2',
|
|
384
406
|
projectItemId: 'PVTI_np',
|
|
@@ -393,7 +415,7 @@ describe('consoleOperationApi', () => {
|
|
|
393
415
|
|
|
394
416
|
it('closes a pull request via the triage close action without an invalid state_reason', async () => {
|
|
395
417
|
const response = await handleTriage(context, {
|
|
396
|
-
pjcode: '
|
|
418
|
+
pjcode: 'acme',
|
|
397
419
|
action: 'close',
|
|
398
420
|
issueUrl: 'https://github.com/o/r/pull/7',
|
|
399
421
|
projectItemId: 'PVTI_prclose',
|
|
@@ -408,7 +430,7 @@ describe('consoleOperationApi', () => {
|
|
|
408
430
|
|
|
409
431
|
it('closes a pull request via the triage close_not_planned action through the pull-request close path', async () => {
|
|
410
432
|
const response = await handleTriage(context, {
|
|
411
|
-
pjcode: '
|
|
433
|
+
pjcode: 'acme',
|
|
412
434
|
action: 'close_not_planned',
|
|
413
435
|
issueUrl: 'https://github.com/o/r/pull/8',
|
|
414
436
|
projectItemId: 'PVTI_prnp',
|
|
@@ -423,7 +445,7 @@ describe('consoleOperationApi', () => {
|
|
|
423
445
|
|
|
424
446
|
it('rejects an unknown triage action', async () => {
|
|
425
447
|
const response = await handleTriage(context, {
|
|
426
|
-
pjcode: '
|
|
448
|
+
pjcode: 'acme',
|
|
427
449
|
action: 'unknown',
|
|
428
450
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
429
451
|
projectItemId: 'PVTI_h',
|
|
@@ -433,7 +455,7 @@ describe('consoleOperationApi', () => {
|
|
|
433
455
|
|
|
434
456
|
it('rejects set_status without a status name', async () => {
|
|
435
457
|
const response = await handleTriage(context, {
|
|
436
|
-
pjcode: '
|
|
458
|
+
pjcode: 'acme',
|
|
437
459
|
action: 'set_status',
|
|
438
460
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
439
461
|
projectItemId: 'PVTI_h',
|
|
@@ -443,7 +465,7 @@ describe('consoleOperationApi', () => {
|
|
|
443
465
|
|
|
444
466
|
it('rejects set_story without a story option id', async () => {
|
|
445
467
|
const response = await handleTriage(context, {
|
|
446
|
-
pjcode: '
|
|
468
|
+
pjcode: 'acme',
|
|
447
469
|
action: 'set_story',
|
|
448
470
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
449
471
|
projectItemId: 'PVTI_h',
|
|
@@ -457,7 +479,7 @@ describe('consoleOperationApi', () => {
|
|
|
457
479
|
story: null,
|
|
458
480
|
});
|
|
459
481
|
const response = await handleTriage(contextWithoutStory, {
|
|
460
|
-
pjcode: '
|
|
482
|
+
pjcode: 'acme',
|
|
461
483
|
action: 'set_story',
|
|
462
484
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
463
485
|
projectItemId: 'PVTI_h',
|
|
@@ -469,7 +491,7 @@ describe('consoleOperationApi', () => {
|
|
|
469
491
|
|
|
470
492
|
it('rejects a missing issueUrl', async () => {
|
|
471
493
|
const response = await handleTriage(context, {
|
|
472
|
-
pjcode: '
|
|
494
|
+
pjcode: 'acme',
|
|
473
495
|
action: 'set_status',
|
|
474
496
|
projectItemId: 'PVTI_h',
|
|
475
497
|
statusName: 'Todo',
|
|
@@ -480,7 +502,7 @@ describe('consoleOperationApi', () => {
|
|
|
480
502
|
it('sets the story using the request project item id without a GraphQL item fetch', async () => {
|
|
481
503
|
issueRepository.get.mockResolvedValue(null);
|
|
482
504
|
const response = await handleTriage(context, {
|
|
483
|
-
pjcode: '
|
|
505
|
+
pjcode: 'acme',
|
|
484
506
|
action: 'set_story',
|
|
485
507
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
486
508
|
projectItemId: 'PVTI_h',
|
|
@@ -505,12 +527,12 @@ describe('consoleOperationApi', () => {
|
|
|
505
527
|
|
|
506
528
|
beforeEach(() => {
|
|
507
529
|
resolveProjectSpy = jest.fn(async (pjcode: string) =>
|
|
508
|
-
pjcode === '
|
|
530
|
+
pjcode === 'acme' ? { pjcode, project } : null,
|
|
509
531
|
);
|
|
510
532
|
spiedContext = {
|
|
511
|
-
issueRepository,
|
|
533
|
+
resolveIssueRepository: () => issueRepository,
|
|
512
534
|
resolveProject: resolveProjectSpy,
|
|
513
|
-
isPjcodeConfigured: (pjcode: string) => pjcode === '
|
|
535
|
+
isPjcodeConfigured: (pjcode: string) => pjcode === 'acme',
|
|
514
536
|
consoleDataOutputDir: baseDir,
|
|
515
537
|
issueAttachmentRepository: null,
|
|
516
538
|
};
|
|
@@ -518,7 +540,7 @@ describe('consoleOperationApi', () => {
|
|
|
518
540
|
|
|
519
541
|
it('closes an issue via triage without resolving the project', async () => {
|
|
520
542
|
const response = await handleTriage(spiedContext, {
|
|
521
|
-
pjcode: '
|
|
543
|
+
pjcode: 'acme',
|
|
522
544
|
action: 'close',
|
|
523
545
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
524
546
|
projectItemId: 'PVTI_noproj_close',
|
|
@@ -539,7 +561,7 @@ describe('consoleOperationApi', () => {
|
|
|
539
561
|
|
|
540
562
|
it('closes not planned via triage without resolving the project', async () => {
|
|
541
563
|
const response = await handleTriage(spiedContext, {
|
|
542
|
-
pjcode: '
|
|
564
|
+
pjcode: 'acme',
|
|
543
565
|
action: 'close_not_planned',
|
|
544
566
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
545
567
|
projectItemId: 'PVTI_noproj_np',
|
|
@@ -554,7 +576,7 @@ describe('consoleOperationApi', () => {
|
|
|
554
576
|
|
|
555
577
|
it('closes a pull request via review without resolving the project', async () => {
|
|
556
578
|
const response = await handleReview(spiedContext, {
|
|
557
|
-
pjcode: '
|
|
579
|
+
pjcode: 'acme',
|
|
558
580
|
action: 'close',
|
|
559
581
|
prUrl: 'https://github.com/o/r/pull/1',
|
|
560
582
|
projectItemId: 'PVTI_noproj_reviewclose',
|
|
@@ -580,7 +602,7 @@ describe('consoleOperationApi', () => {
|
|
|
580
602
|
|
|
581
603
|
it('sets intmux without a GraphQL item fetch while resolving the project', async () => {
|
|
582
604
|
const response = await handleIntmux(spiedContext, {
|
|
583
|
-
pjcode: '
|
|
605
|
+
pjcode: 'acme',
|
|
584
606
|
action: 'set_intmux',
|
|
585
607
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
586
608
|
projectItemId: 'PVTI_needproj_intmux',
|
|
@@ -597,7 +619,7 @@ describe('consoleOperationApi', () => {
|
|
|
597
619
|
|
|
598
620
|
it('resolves the project for set_status but performs no GraphQL item fetch', async () => {
|
|
599
621
|
const response = await handleTriage(spiedContext, {
|
|
600
|
-
pjcode: '
|
|
622
|
+
pjcode: 'acme',
|
|
601
623
|
action: 'set_status',
|
|
602
624
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
603
625
|
projectItemId: 'PVTI_needproj_status',
|
|
@@ -611,7 +633,7 @@ describe('consoleOperationApi', () => {
|
|
|
611
633
|
|
|
612
634
|
it('resolves the project for set_story but performs no GraphQL item fetch', async () => {
|
|
613
635
|
const response = await handleTriage(spiedContext, {
|
|
614
|
-
pjcode: '
|
|
636
|
+
pjcode: 'acme',
|
|
615
637
|
action: 'set_story',
|
|
616
638
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
617
639
|
projectItemId: 'PVTI_needproj_story',
|
|
@@ -625,7 +647,7 @@ describe('consoleOperationApi', () => {
|
|
|
625
647
|
|
|
626
648
|
it('resolves the project for snooze and passes the item id without a GraphQL item fetch', async () => {
|
|
627
649
|
const response = await handleTriage(spiedContext, {
|
|
628
|
-
pjcode: '
|
|
650
|
+
pjcode: 'acme',
|
|
629
651
|
action: 'snooze_1day',
|
|
630
652
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
631
653
|
projectItemId: 'PVTI_needproj_snooze',
|
|
@@ -644,7 +666,7 @@ describe('consoleOperationApi', () => {
|
|
|
644
666
|
describe('handleIntmux', () => {
|
|
645
667
|
it('sets the In Tmux by human status and records done', async () => {
|
|
646
668
|
const response = await handleIntmux(context, {
|
|
647
|
-
pjcode: '
|
|
669
|
+
pjcode: 'acme',
|
|
648
670
|
action: 'set_intmux',
|
|
649
671
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
650
672
|
projectItemId: 'PVTI_i',
|
|
@@ -664,7 +686,7 @@ describe('consoleOperationApi', () => {
|
|
|
664
686
|
|
|
665
687
|
it('rejects an unknown intmux action', async () => {
|
|
666
688
|
const response = await handleIntmux(context, {
|
|
667
|
-
pjcode: '
|
|
689
|
+
pjcode: 'acme',
|
|
668
690
|
action: 'unset_intmux',
|
|
669
691
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
670
692
|
projectItemId: 'PVTI_i',
|
|
@@ -675,7 +697,7 @@ describe('consoleOperationApi', () => {
|
|
|
675
697
|
it('sets intmux using the request project item id without a GraphQL item fetch', async () => {
|
|
676
698
|
issueRepository.get.mockResolvedValue(null);
|
|
677
699
|
const response = await handleIntmux(context, {
|
|
678
|
-
pjcode: '
|
|
700
|
+
pjcode: 'acme',
|
|
679
701
|
action: 'set_intmux',
|
|
680
702
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
681
703
|
projectItemId: 'PVTI_i',
|
|
@@ -691,7 +713,7 @@ describe('consoleOperationApi', () => {
|
|
|
691
713
|
|
|
692
714
|
it('rejects a missing issueUrl', async () => {
|
|
693
715
|
const response = await handleIntmux(context, {
|
|
694
|
-
pjcode: '
|
|
716
|
+
pjcode: 'acme',
|
|
695
717
|
action: 'set_intmux',
|
|
696
718
|
projectItemId: 'PVTI_i',
|
|
697
719
|
});
|
|
@@ -700,7 +722,7 @@ describe('consoleOperationApi', () => {
|
|
|
700
722
|
|
|
701
723
|
it('rejects a missing projectItemId', async () => {
|
|
702
724
|
const response = await handleIntmux(context, {
|
|
703
|
-
pjcode: '
|
|
725
|
+
pjcode: 'acme',
|
|
704
726
|
action: 'set_intmux',
|
|
705
727
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
706
728
|
});
|
|
@@ -709,7 +731,7 @@ describe('consoleOperationApi', () => {
|
|
|
709
731
|
|
|
710
732
|
it('rejects a missing action', async () => {
|
|
711
733
|
const response = await handleIntmux(context, {
|
|
712
|
-
pjcode: '
|
|
734
|
+
pjcode: 'acme',
|
|
713
735
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
714
736
|
projectItemId: 'PVTI_i',
|
|
715
737
|
});
|
|
@@ -744,23 +766,23 @@ describe('consoleOperationApi', () => {
|
|
|
744
766
|
it('records the .done exclusion under the resolved pjcode', async () => {
|
|
745
767
|
const otherProject: Project = { ...project, id: 'PVT_other' };
|
|
746
768
|
const multiContext: ConsoleOperationContext = {
|
|
747
|
-
issueRepository,
|
|
769
|
+
resolveIssueRepository: () => issueRepository,
|
|
748
770
|
resolveProject: async (pjcode: string) => {
|
|
749
|
-
if (pjcode === '
|
|
771
|
+
if (pjcode === 'acme') {
|
|
750
772
|
return { pjcode, project };
|
|
751
773
|
}
|
|
752
|
-
if (pjcode === '
|
|
774
|
+
if (pjcode === 'globex') {
|
|
753
775
|
return { pjcode, project: otherProject };
|
|
754
776
|
}
|
|
755
777
|
return null;
|
|
756
778
|
},
|
|
757
779
|
isPjcodeConfigured: (pjcode: string) =>
|
|
758
|
-
pjcode === '
|
|
780
|
+
pjcode === 'acme' || pjcode === 'globex',
|
|
759
781
|
consoleDataOutputDir: baseDir,
|
|
760
782
|
issueAttachmentRepository: null,
|
|
761
783
|
};
|
|
762
784
|
const response = await handleTriage(multiContext, {
|
|
763
|
-
pjcode: '
|
|
785
|
+
pjcode: 'globex',
|
|
764
786
|
action: 'set_status',
|
|
765
787
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
766
788
|
projectItemId: 'PVTI_x',
|
|
@@ -773,10 +795,10 @@ describe('consoleOperationApi', () => {
|
|
|
773
795
|
'status_todo',
|
|
774
796
|
);
|
|
775
797
|
for (const tab of CONSOLE_DONE_TAB_NAMES) {
|
|
776
|
-
expect(readDoneProjectItemIds(baseDir, '
|
|
798
|
+
expect(readDoneProjectItemIds(baseDir, 'globex', tab)).toContain(
|
|
777
799
|
'PVTI_x',
|
|
778
800
|
);
|
|
779
|
-
expect(readDoneProjectItemIds(baseDir, '
|
|
801
|
+
expect(readDoneProjectItemIds(baseDir, 'acme', tab)).not.toContain(
|
|
780
802
|
'PVTI_x',
|
|
781
803
|
);
|
|
782
804
|
}
|
|
@@ -790,7 +812,7 @@ describe('consoleOperationApi', () => {
|
|
|
790
812
|
consoleDataOutputDir: null,
|
|
791
813
|
};
|
|
792
814
|
const response = await handleIntmux(noStorageContext, {
|
|
793
|
-
pjcode: '
|
|
815
|
+
pjcode: 'acme',
|
|
794
816
|
action: 'set_intmux',
|
|
795
817
|
issueUrl: 'https://github.com/o/r/issues/1',
|
|
796
818
|
projectItemId: 'PVTI_j',
|
|
@@ -814,7 +836,7 @@ describe('consoleOperationApi', () => {
|
|
|
814
836
|
},
|
|
815
837
|
]);
|
|
816
838
|
const response = await handleComment(context, {
|
|
817
|
-
pjcode: '
|
|
839
|
+
pjcode: 'acme',
|
|
818
840
|
url: 'https://github.com/o/r/issues/1',
|
|
819
841
|
body: 'Please rebase onto the latest main branch.',
|
|
820
842
|
});
|
|
@@ -836,7 +858,7 @@ describe('consoleOperationApi', () => {
|
|
|
836
858
|
it('falls back to the posted body when no comment is returned', async () => {
|
|
837
859
|
issueRepository.getIssueOrPullRequestComments.mockResolvedValue([]);
|
|
838
860
|
const response = await handleComment(context, {
|
|
839
|
-
pjcode: '
|
|
861
|
+
pjcode: 'acme',
|
|
840
862
|
url: 'https://github.com/o/r/issues/1',
|
|
841
863
|
body: 'A first comment on this issue.',
|
|
842
864
|
});
|
|
@@ -853,7 +875,7 @@ describe('consoleOperationApi', () => {
|
|
|
853
875
|
|
|
854
876
|
it('rejects when url is missing', async () => {
|
|
855
877
|
const response = await handleComment(context, {
|
|
856
|
-
pjcode: '
|
|
878
|
+
pjcode: 'acme',
|
|
857
879
|
body: 'A comment without a target url.',
|
|
858
880
|
});
|
|
859
881
|
expect(response.statusCode).toBe(400);
|
|
@@ -862,7 +884,7 @@ describe('consoleOperationApi', () => {
|
|
|
862
884
|
|
|
863
885
|
it('rejects when body is missing', async () => {
|
|
864
886
|
const response = await handleComment(context, {
|
|
865
|
-
pjcode: '
|
|
887
|
+
pjcode: 'acme',
|
|
866
888
|
url: 'https://github.com/o/r/issues/1',
|
|
867
889
|
});
|
|
868
890
|
expect(response.statusCode).toBe(400);
|
|
@@ -872,7 +894,7 @@ describe('consoleOperationApi', () => {
|
|
|
872
894
|
|
|
873
895
|
describe('handleReviewComment', () => {
|
|
874
896
|
const validRequest = {
|
|
875
|
-
pjcode: '
|
|
897
|
+
pjcode: 'acme',
|
|
876
898
|
url: 'https://github.com/o/r/pull/1',
|
|
877
899
|
path: 'src/index.ts',
|
|
878
900
|
line: 42,
|
|
@@ -969,7 +991,7 @@ describe('consoleOperationApi', () => {
|
|
|
969
991
|
const listItemUrl = 'https://github.com/o/r/issues/1';
|
|
970
992
|
|
|
971
993
|
const writeListWithItem = (url: string): void => {
|
|
972
|
-
const dir = path.join(baseDir, '
|
|
994
|
+
const dir = path.join(baseDir, 'acme', 'prs');
|
|
973
995
|
fs.mkdirSync(dir, { recursive: true });
|
|
974
996
|
fs.writeFileSync(
|
|
975
997
|
path.join(dir, 'list.json'),
|
|
@@ -1004,7 +1026,7 @@ describe('consoleOperationApi', () => {
|
|
|
1004
1026
|
return '';
|
|
1005
1027
|
}),
|
|
1006
1028
|
{
|
|
1007
|
-
pjcode: '
|
|
1029
|
+
pjcode: 'acme',
|
|
1008
1030
|
url: 'https://github.com/o/r/issues/1',
|
|
1009
1031
|
fileName: 'shot.png',
|
|
1010
1032
|
contentBase64: Buffer.from([1, 2, 3]).toString('base64'),
|
|
@@ -1028,7 +1050,7 @@ describe('consoleOperationApi', () => {
|
|
|
1028
1050
|
it('rejects a request without a url', async () => {
|
|
1029
1051
|
const response = await handleAttachmentUpload(
|
|
1030
1052
|
uploadContext(async () => 'unused'),
|
|
1031
|
-
{ pjcode: '
|
|
1053
|
+
{ pjcode: 'acme', fileName: 'shot.png', contentBase64: 'AAEC' },
|
|
1032
1054
|
);
|
|
1033
1055
|
expect(response).toEqual({
|
|
1034
1056
|
statusCode: 400,
|
|
@@ -1040,7 +1062,7 @@ describe('consoleOperationApi', () => {
|
|
|
1040
1062
|
const response = await handleAttachmentUpload(
|
|
1041
1063
|
uploadContext(async () => 'unused'),
|
|
1042
1064
|
{
|
|
1043
|
-
pjcode: '
|
|
1065
|
+
pjcode: 'acme',
|
|
1044
1066
|
url: 'https://example.com/o/r/issues/1; rm -rf /',
|
|
1045
1067
|
fileName: 'shot.png',
|
|
1046
1068
|
contentBase64: 'AAEC',
|
|
@@ -1056,7 +1078,7 @@ describe('consoleOperationApi', () => {
|
|
|
1056
1078
|
const response = await handleAttachmentUpload(
|
|
1057
1079
|
uploadContext(async () => 'unused'),
|
|
1058
1080
|
{
|
|
1059
|
-
pjcode: '
|
|
1081
|
+
pjcode: 'acme',
|
|
1060
1082
|
url: 'https://github.com/o/r/issues/1',
|
|
1061
1083
|
contentBase64: 'AAEC',
|
|
1062
1084
|
},
|
|
@@ -1071,7 +1093,7 @@ describe('consoleOperationApi', () => {
|
|
|
1071
1093
|
const response = await handleAttachmentUpload(
|
|
1072
1094
|
uploadContext(async () => 'unused'),
|
|
1073
1095
|
{
|
|
1074
|
-
pjcode: '
|
|
1096
|
+
pjcode: 'acme',
|
|
1075
1097
|
url: 'https://github.com/o/r/issues/1',
|
|
1076
1098
|
fileName: 'shot.png',
|
|
1077
1099
|
},
|
|
@@ -1086,7 +1108,7 @@ describe('consoleOperationApi', () => {
|
|
|
1086
1108
|
const response = await handleAttachmentUpload(
|
|
1087
1109
|
{ ...context, issueAttachmentRepository: null },
|
|
1088
1110
|
{
|
|
1089
|
-
pjcode: '
|
|
1111
|
+
pjcode: 'acme',
|
|
1090
1112
|
url: 'https://github.com/o/r/issues/1',
|
|
1091
1113
|
fileName: 'shot.png',
|
|
1092
1114
|
contentBase64: 'AAEC',
|
|
@@ -1102,7 +1124,7 @@ describe('consoleOperationApi', () => {
|
|
|
1102
1124
|
const response = await handleAttachmentUpload(
|
|
1103
1125
|
uploadContext(async () => 'unused'),
|
|
1104
1126
|
{
|
|
1105
|
-
pjcode: '
|
|
1127
|
+
pjcode: 'acme',
|
|
1106
1128
|
url: 'https://github.com/o/r/issues/9999',
|
|
1107
1129
|
fileName: 'shot.png',
|
|
1108
1130
|
contentBase64: 'AAEC',
|