github-issue-tower-defence-management 1.189.0 → 1.189.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.
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>TDPM Console</title>
7
- <script type="module" crossorigin src="/assets/index-CZ1NNzIm.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-B22eMy23.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-CLHvrafO.css">
9
9
  </head>
10
10
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-issue-tower-defence-management",
3
- "version": "1.189.0",
3
+ "version": "1.189.1",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "scripts": {
@@ -292,6 +292,34 @@ describe('consoleOperationApi', () => {
292
292
  expectRecordedAcrossTabs('PVTI_c');
293
293
  });
294
294
 
295
+ it('closes a pull request and moves linked issue to Awaiting workspace when issueUrl is provided', async () => {
296
+ const response = await handleReview(context, {
297
+ pjcode: 'acme',
298
+ action: 'close',
299
+ prUrl: 'https://github.com/o/r/pull/1',
300
+ issueUrl: 'https://github.com/o/r/issues/7',
301
+ projectItemId: 'PVTI_c_totally_wrong',
302
+ commentBody: 'totally wrong',
303
+ });
304
+ expect(response.statusCode).toBe(200);
305
+ expect(issueRepository.closePullRequest).toHaveBeenCalledWith(
306
+ 'https://github.com/o/r/pull/1',
307
+ );
308
+ expect(issueRepository.createCommentByUrl).toHaveBeenCalledWith(
309
+ 'https://github.com/o/r/pull/1',
310
+ 'totally wrong',
311
+ );
312
+ expect(issueRepository.updateStatus).toHaveBeenCalledWith(
313
+ project,
314
+ expect.objectContaining({
315
+ itemId: 'PVTI_c_totally_wrong',
316
+ url: 'https://github.com/o/r/issues/7',
317
+ }),
318
+ 'status_aw',
319
+ );
320
+ expectRecordedAcrossTabs('PVTI_c_totally_wrong');
321
+ });
322
+
295
323
  it('marks a pull request unnecessary by closing it, labelling the item chore and moving it to Awaiting workspace', async () => {
296
324
  issueRepository.getIssueByUrl.mockResolvedValue({
297
325
  ...issue,
@@ -294,6 +294,23 @@ export const handleReview = async (
294
294
  .resolveIssueRepository(prUrl)
295
295
  .createCommentByUrl(prUrl, body.commentBody);
296
296
  }
297
+ const issueUrl = body.issueUrl;
298
+ if (isNonEmptyString(issueUrl)) {
299
+ const binding = await context.resolveProject(pjcodeResult);
300
+ if (binding === null) {
301
+ return badRequest(`no project configured for pjcode "${pjcodeResult}"`);
302
+ }
303
+ const statusFailure = await updateStatusByName(
304
+ context.resolveIssueRepository(issueUrl),
305
+ binding.project,
306
+ issueUrl,
307
+ projectItemId,
308
+ AWAITING_WORKSPACE_STATUS_NAME,
309
+ );
310
+ if (statusFailure !== null) {
311
+ return statusFailure;
312
+ }
313
+ }
297
314
  recordDone(context, pjcodeResult, projectItemId);
298
315
  return ok();
299
316
  }
@@ -68,6 +68,7 @@ describe('useConsoleOperations', () => {
68
68
  pjcode: 'acme',
69
69
  action: 'close',
70
70
  prUrl: prItem.url,
71
+ issueUrl: prItem.url,
71
72
  commentBody: 'totally wrong',
72
73
  });
73
74
  });
@@ -113,6 +113,7 @@ const reviewRequest = (
113
113
  pjcode,
114
114
  action: 'close',
115
115
  prUrl,
116
+ issueUrl: item.url,
116
117
  projectItemId: item.projectItemId,
117
118
  commentBody: TOTALLY_WRONG_COMMENT_BODY,
118
119
  };