Skip to content

Commit e575737

Browse files
committed
test: cover missing- and corrupt-text branches of the disabled-tools notice
The patch-coverage check flagged two untested branches in the ChatRow case that renders the ignored disabled-tools notice: the row renders nothing when the message carries no text, and when the stored payload is not valid JSON. Add spec cases for both so every render path of the notice is covered.
1 parent 0d332ee commit e575737

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

‎webview-ui/src/components/chat/__tests__/IgnoredDisabledToolsNotice.spec.tsx‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,31 @@ describe("ChatRow - ignored disabled-tools notice", () => {
5757
screen.getByText("The following tools cannot be disabled and will remain available: attempt_completion."),
5858
).toBeInTheDocument()
5959
})
60+
61+
it("renders nothing when the notice message text is missing", () => {
62+
const message: ClineMessage = {
63+
type: "say",
64+
say: "ignored_disabled_tools_warning",
65+
ts: Date.now(),
66+
}
67+
68+
const { container } = renderChatRow(message)
69+
70+
expect(container.firstChild).toBeNull()
71+
expect(screen.queryByText("Disabled tool ignored")).not.toBeInTheDocument()
72+
})
73+
74+
it("renders nothing when the notice payload is not valid JSON", () => {
75+
const message: ClineMessage = {
76+
type: "say",
77+
say: "ignored_disabled_tools_warning",
78+
ts: Date.now(),
79+
text: "{not valid json",
80+
}
81+
82+
const { container } = renderChatRow(message)
83+
84+
expect(container.firstChild).toBeNull()
85+
expect(screen.queryByText("Disabled tool ignored")).not.toBeInTheDocument()
86+
})
6087
})

0 commit comments

Comments
 (0)