Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (claude): isolate model/provider branch coverage in hasUnsavedEdits tests

[._.]/ Adam Eivy56f621f743bb
diff --git a/client/src/components/cos/tabs/TaskItem.test.jsx b/client/src/components/cos/tabs/TaskItem.test.jsx
index 797568ba70..85022ad58e 100644
--- a/client/src/components/cos/tabs/TaskItem.test.jsx
+++ b/client/src/components/cos/tabs/TaskItem.test.jsx
@@ -294,10 +294,10 @@ describe('TaskItem cancel-edit confirmation (#4037)', () => {
expect(screen.queryByRole('button', { name: 'Save' })).not.toBeInTheDocument();
});
- it('shows the confirm row when only a non-description field (context) changed', () => {
- // Pins hasUnsavedEdits' context/model/provider branches, not just description —
- // a regression narrowing the comparison to description alone would still pass
- // every other test in this block since they all edit description.
+ it('shows the confirm row when only the context field changed', () => {
+ // Pins hasUnsavedEdits' context branch specifically — a regression narrowing
+ // the comparison to description alone would still pass every other test in
+ // this block since they all edit description.
render(<TaskItem task={task} isSystem onRefresh={vi.fn()} providers={providers} />);
fireEvent.click(screen.getByRole('button', { name: 'Edit task' }));
@@ -308,6 +308,30 @@ describe('TaskItem cancel-edit confirmation (#4037)', () => {
expect(screen.queryByRole('button', { name: 'Save' })).not.toBeInTheDocument();
});
+ it('shows the confirm row when only the model select changed', () => {
+ // Pins hasUnsavedEdits' model branch in isolation (provider left untouched).
+ render(<TaskItem task={task} isSystem onRefresh={vi.fn()} providers={providers} />);
+
+ fireEvent.click(screen.getByRole('button', { name: 'Edit task' }));
+ const [, modelSelect] = screen.getAllByRole('combobox');
+ fireEvent.change(modelSelect, { target: { value: '' } });
+ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }));
+
+ expect(screen.getByRole('group', { name: 'Confirm discard task edits' })).toBeInTheDocument();
+ });
+
+ it('shows the confirm row when only the provider select changed', () => {
+ // Pins hasUnsavedEdits' provider branch.
+ render(<TaskItem task={task} isSystem onRefresh={vi.fn()} providers={providers} />);
+
+ fireEvent.click(screen.getByRole('button', { name: 'Edit task' }));
+ const [providerSelect] = screen.getAllByRole('combobox');
+ fireEvent.change(providerSelect, { target: { value: '' } });
+ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }));
+
+ expect(screen.getByRole('group', { name: 'Confirm discard task edits' })).toBeInTheDocument();
+ });
+
it('discards the draft on a second click confirming the discard', () => {
render(<TaskItem task={task} isSystem onRefresh={vi.fn()} providers={providers} />);