Skip to content

Commit d37f7f0

Browse files
CopilotCopilot
authored andcommitted
fix: improve test clarity based on code review feedback
- Clarify comment about multiNode button disable behavior - Improve comment about invalid params in multiNode mode - Simplify ExecutePlaybookForm test comment - Use more precise count assertion for getAllByText('3') Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 7949e33 commit d37f7f0

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

frontend/src/components/AggregatedResultsView.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ describe('AggregatedResultsView Component', () => {
226226

227227
await waitFor(() => {
228228
expect(screen.getByText(/total/i)).toBeTruthy();
229-
expect(screen.getAllByText('3').length).toBeGreaterThanOrEqual(1);
229+
expect(screen.getAllByText('3').length).toBeGreaterThanOrEqual(2); // total=3 and success=3
230230
});
231231
});
232232

@@ -241,7 +241,7 @@ describe('AggregatedResultsView Component', () => {
241241

242242
await waitFor(() => {
243243
expect(screen.getAllByText(/success/i).length).toBeGreaterThanOrEqual(1);
244-
expect(screen.getAllByText('3').length).toBeGreaterThanOrEqual(1);
244+
expect(screen.getAllByText('3').length).toBeGreaterThanOrEqual(2); // total=3 and success=3
245245
});
246246
});
247247

frontend/src/components/ParallelExecutionModal.test.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,9 @@ describe('ParallelExecutionModal Component', () => {
10781078

10791079
await fireEvent.input(parametersTextarea, { target: { value: invalidJson } });
10801080

1081-
// In multiNode mode, parameter errors are handled silently (no error text shown)
1081+
// In multiNode mode, parameter errors are silently ignored on input.
1082+
// ExecuteCommandForm only shows errors on explicit submit (button hidden in multiNode mode).
1083+
// Invalid params prevent actionFormData from updating, but show no error text.
10821084
// Verify the textarea accepts the value without crashing
10831085
expect((parametersTextarea as HTMLTextAreaElement).value).toBe(invalidJson);
10841086
expect(screen.queryByText(/enter command/i)).toBeNull(); // modal still functional
@@ -1142,11 +1144,12 @@ describe('ParallelExecutionModal Component', () => {
11421144
const checkboxes = screen.getAllByRole('checkbox');
11431145
await fireEvent.click(checkboxes[0]);
11441146

1145-
// Enter invalid parameters without a command (so actionFormData is never set)
1147+
// Enter invalid parameters without a command (so actionFormData is never set
1148+
// since ExecuteCommandForm's $effect only calls onSubmit with valid data)
11461149
const parametersTextarea = screen.getByLabelText('Parameters (Optional)');
11471150
await fireEvent.input(parametersTextarea, { target: { value: '{invalid}' } });
11481151

1149-
// Button is disabled because no valid form data has been submitted
1152+
// Button is disabled because no valid form data has been submitted yet
11501153
await waitFor(() => {
11511154
const executeButton = screen.getByRole('button', { name: /execute on 1 target/i });
11521155
expect((executeButton as HTMLButtonElement).disabled).toBe(true);
@@ -2680,9 +2683,8 @@ describe('ParallelExecutionModal Component', () => {
26802683
await fireEvent.input(playbookInput, { target: { value: '/path/to/playbook.yml' } });
26812684
expect((playbookInput as HTMLInputElement).value).toBe('/path/to/playbook.yml');
26822685

2683-
// Note: ExecutePlaybookForm is rendered inside the modal's form (nested).
2684-
// In multiNode mode, actionFormData is set when the inner form is submitted.
2685-
// The form renders correctly with the expected input.
2686+
// Note: ExecutePlaybookForm does not use a $effect for multiNode reactive updates.
2687+
// The form renders correctly with the expected input field.
26862688
});
26872689

26882690
it('should build correct request for install-software action', async () => {

0 commit comments

Comments
 (0)