github-issue-tower-defence-management 1.191.0 → 1.193.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.
Files changed (26) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/bin/adapter/entry-points/console/consoleOperationApi.js +9 -2
  3. package/bin/adapter/entry-points/console/consoleOperationApi.js.map +1 -1
  4. package/bin/adapter/entry-points/console/ui-dist/assets/{index-B22eMy23.js → index-RaFqjB7u.js} +3 -3
  5. package/bin/adapter/entry-points/console/ui-dist/index.html +1 -1
  6. package/bin/domain/usecases/StartPreparationUseCase.js +58 -20
  7. package/bin/domain/usecases/StartPreparationUseCase.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/adapter/entry-points/console/consoleOperationApi.test.ts +19 -5
  10. package/src/adapter/entry-points/console/consoleOperationApi.ts +18 -1
  11. package/src/adapter/entry-points/console/ui/e2e/consoleScenario.spec.ts +35 -1
  12. package/src/adapter/entry-points/console/ui/e2e/consoleTestHarness.ts +13 -1
  13. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleCommentComposer.stories.tsx +7 -0
  14. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleCommentComposer.test.tsx +82 -0
  15. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleCommentComposer.tsx +23 -3
  16. package/src/adapter/entry-points/console/ui/src/features/console/logic/operations.ts +4 -3
  17. package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsoleItemDetailContainer.test.tsx +79 -0
  18. package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsoleItemDetailContainer.tsx +19 -3
  19. package/src/adapter/entry-points/console/ui-dist/assets/{index-B22eMy23.js → index-RaFqjB7u.js} +3 -3
  20. package/src/adapter/entry-points/console/ui-dist/index.html +1 -1
  21. package/src/domain/usecases/StartPreparationUseCase.test.ts +104 -1
  22. package/src/domain/usecases/StartPreparationUseCase.ts +121 -31
  23. package/types/adapter/entry-points/console/consoleOperationApi.d.ts +1 -0
  24. package/types/adapter/entry-points/console/consoleOperationApi.d.ts.map +1 -1
  25. package/types/domain/usecases/StartPreparationUseCase.d.ts +10 -1
  26. package/types/domain/usecases/StartPreparationUseCase.d.ts.map +1 -1
@@ -2,6 +2,7 @@ import { fireEvent, render, waitFor } from '@testing-library/react';
2
2
  import type { ConsoleCaches } from '../hooks/useConsoleCaches';
3
3
  import type { ConsoleOperationsApi } from '../hooks/useConsoleOperations';
4
4
  import { ResourceCache } from '../lib/resourceCache';
5
+ import { AWAITING_WORKSPACE_NAME } from '../logic/operations';
5
6
  import type {
6
7
  ConsoleChangedFile,
7
8
  ConsoleRelatedPullRequest,
@@ -405,6 +406,84 @@ describe('ConsoleItemDetailContainer', () => {
405
406
  ]);
406
407
  });
407
408
 
409
+ it('passes onSubmitAndMoveToAwaitingWorkspace to the composer when statusOptions includes Awaiting Workspace', () => {
410
+ const { getByText } = render(
411
+ <ConsoleItemDetailContainer
412
+ tab="todo-by-human"
413
+ item={issueItem}
414
+ caches={buildCaches()}
415
+ operations={buildOperations()}
416
+ statusOptions={consoleStatusOptionsFixture}
417
+ storyOptions={consoleStoryOptionsFixture}
418
+ storyColors={consoleStoryColorsFixture}
419
+ storyName="TDPM Console port"
420
+ overlayStatus={null}
421
+ now={Date.parse('2026-06-19T12:00:00.000Z')}
422
+ onQueueAction={jest.fn()}
423
+ />,
424
+ );
425
+ expect(getByText('Comment & Awaiting Workspace')).toBeInTheDocument();
426
+ });
427
+
428
+ it('does not pass onSubmitAndMoveToAwaitingWorkspace to the composer when statusOptions does not include Awaiting Workspace', () => {
429
+ const statusOptionsWithoutAwaitingWorkspace =
430
+ consoleStatusOptionsFixture.filter(
431
+ (o) => o.name !== AWAITING_WORKSPACE_NAME,
432
+ );
433
+ const { queryByText } = render(
434
+ <ConsoleItemDetailContainer
435
+ tab="todo-by-human"
436
+ item={issueItem}
437
+ caches={buildCaches()}
438
+ operations={buildOperations()}
439
+ statusOptions={statusOptionsWithoutAwaitingWorkspace}
440
+ storyOptions={consoleStoryOptionsFixture}
441
+ storyColors={consoleStoryColorsFixture}
442
+ storyName="TDPM Console port"
443
+ overlayStatus={null}
444
+ now={Date.parse('2026-06-19T12:00:00.000Z')}
445
+ onQueueAction={jest.fn()}
446
+ />,
447
+ );
448
+ expect(queryByText('Comment & Awaiting Workspace')).toBeNull();
449
+ });
450
+
451
+ it('clicking Comment & Awaiting Workspace calls addComment and queues a set_status action for the Awaiting Workspace option', async () => {
452
+ const operations = buildOperations();
453
+ const onQueueAction = jest.fn();
454
+ const { getByPlaceholderText, getByText } = render(
455
+ <ConsoleItemDetailContainer
456
+ tab="todo-by-human"
457
+ item={issueItem}
458
+ caches={buildCaches()}
459
+ operations={operations}
460
+ statusOptions={consoleStatusOptionsFixture}
461
+ storyOptions={consoleStoryOptionsFixture}
462
+ storyColors={consoleStoryColorsFixture}
463
+ storyName="TDPM Console port"
464
+ overlayStatus={null}
465
+ now={Date.parse('2026-06-19T12:00:00.000Z')}
466
+ onQueueAction={onQueueAction}
467
+ />,
468
+ );
469
+ fireEvent.change(getByPlaceholderText('Leave a comment…'), {
470
+ target: { value: 'test comment body' },
471
+ });
472
+ fireEvent.click(getByText('Comment & Awaiting Workspace'));
473
+ await waitFor(() => {
474
+ expect(operations.addComment).toHaveBeenCalledWith(
475
+ issueItem,
476
+ 'test comment body',
477
+ );
478
+ });
479
+ expect(onQueueAction).toHaveBeenCalledWith(
480
+ expect.objectContaining({
481
+ kind: { type: 'set_status', optionName: AWAITING_WORKSPACE_NAME },
482
+ item: issueItem,
483
+ }),
484
+ );
485
+ });
486
+
408
487
  it('collects an inline comment on an issue related pull request diff, enables Reject, and submits it as the request-changes review for that pull request url', async () => {
409
488
  const operations = buildOperations();
410
489
  const onQueueAction = jest.fn();
@@ -9,9 +9,10 @@ import type { ConsoleOperationsApi } from '../hooks/useConsoleOperations';
9
9
  import { buildImageProxyUrl } from '../lib/imageProxy';
10
10
  import type { ConsoleActionKind } from '../logic/actionToast';
11
11
  import { resolveStoryColorEnum } from '../logic/grouping';
12
- import type {
13
- ConsoleOperationHandlers,
14
- ConsolePendingReviewComment,
12
+ import {
13
+ AWAITING_WORKSPACE_NAME,
14
+ type ConsoleOperationHandlers,
15
+ type ConsolePendingReviewComment,
15
16
  } from '../logic/operations';
16
17
  import { mergePostedComments } from '../logic/postedComments';
17
18
  import type {
@@ -163,6 +164,18 @@ export const ConsoleItemDetailContainer = ({
163
164
  },
164
165
  };
165
166
 
167
+ const awaitingWorkspaceOption =
168
+ statusOptions.find((o) => o.name === AWAITING_WORKSPACE_NAME) ?? null;
169
+
170
+ const addCommentAndMoveToAwaitingWorkspace =
171
+ awaitingWorkspaceOption !== null
172
+ ? async (body: string): Promise<ConsoleComment> => {
173
+ const comment = await addComment(body);
174
+ handlers.onSetStatus(awaitingWorkspaceOption);
175
+ return comment;
176
+ }
177
+ : undefined;
178
+
166
179
  const resolvedStoryName =
167
180
  storyName ?? (item.story.trim() !== '' ? item.story : null);
168
181
  const storyColorEnum: ConsoleColor | null =
@@ -205,6 +218,9 @@ export const ConsoleItemDetailContainer = ({
205
218
  initialDraft={initialCommentDraft}
206
219
  onSubmit={addComment}
207
220
  onDraftChange={onCommentDraftChange}
221
+ onSubmitAndMoveToAwaitingWorkspace={
222
+ addCommentAndMoveToAwaitingWorkspace
223
+ }
208
224
  onUploadFile={(file) => operations.uploadAttachment(item, file)}
209
225
  />
210
226
  }