Skip to content

Commit 0bf7260

Browse files
committed
Shrink Roo diff
1 parent e41f8ea commit 0bf7260

File tree

1 file changed

+33
-74
lines changed

1 file changed

+33
-74
lines changed

webview-ui/src/components/chat/__tests__/ChatView.spec.tsx

Lines changed: 33 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,61 +1086,40 @@ describe("ChatView - Focus Grabbing Tests", () => {
10861086
it("does not grab focus when follow-up question presented", async () => {
10871087
const { getByTestId } = renderChatView()
10881088

1089-
// Clear the initial focus call from useMount effect
1090-
await act(async () => {
1091-
await new Promise((resolve) => setTimeout(resolve))
1092-
})
1093-
mockFocus.mockClear()
1094-
10951089
// First hydrate state with initial task
1096-
await act(async () => {
1097-
mockPostMessage({
1098-
clineMessages: [
1099-
{
1100-
type: "say",
1101-
say: "task",
1102-
ts: Date.now() - 2000,
1103-
text: "Initial task",
1104-
},
1105-
],
1106-
})
1107-
})
1108-
1109-
// Wait for initial state to settle
1110-
await waitFor(() => {
1111-
expect(getByTestId("chat-textarea")).toBeInTheDocument()
1090+
mockPostMessage({
1091+
clineMessages: [
1092+
{
1093+
type: "say",
1094+
say: "task",
1095+
ts: Date.now() - 2000,
1096+
text: "Initial task",
1097+
},
1098+
],
11121099
})
11131100

1114-
// Clear any focus calls from initial state processing
1101+
// Clear any initial calls
11151102
mockFocus.mockClear()
11161103

11171104
// Add follow-up question
1118-
await act(async () => {
1119-
mockPostMessage({
1120-
clineMessages: [
1121-
{
1122-
type: "say",
1123-
say: "task",
1124-
ts: Date.now() - 2000,
1125-
text: "Initial task",
1126-
},
1127-
{
1128-
type: "ask",
1129-
ask: "followup",
1130-
ts: Date.now(),
1131-
text: "Should I continue?",
1132-
},
1133-
],
1134-
})
1135-
})
1136-
1137-
// Wait for the follow-up question to be processed and any debounced effects to complete
1138-
// The useDebounceEffect has a 50ms delay, so we wait longer to ensure it completes
1139-
await act(async () => {
1140-
await new Promise((resolve) => setTimeout(resolve))
1105+
mockPostMessage({
1106+
clineMessages: [
1107+
{
1108+
type: "say",
1109+
say: "task",
1110+
ts: Date.now() - 2000,
1111+
text: "Initial task",
1112+
},
1113+
{
1114+
type: "ask",
1115+
ask: "followup",
1116+
ts: Date.now(),
1117+
text: "Should I continue?",
1118+
},
1119+
],
11411120
})
11421121

1143-
// Ensure the textarea is still in the document
1122+
// Wait a bit to ensure any focus operations would have occurred
11441123
await waitFor(() => {
11451124
expect(getByTestId("chat-textarea")).toBeInTheDocument()
11461125
})
@@ -1349,33 +1328,13 @@ it.skip("ChatView - RooCloudCTA Display Tests", () => {
13491328
mockPostMessage({
13501329
cloudIsAuthenticated: false,
13511330
taskHistory: [
1352-
{ id: "1", ts: Date.now() - 3000 },
1353-
{ id: "2", ts: Date.now() - 2000 },
1354-
{ id: "3", ts: Date.now() - 1000 },
1355-
{ id: "4", ts: Date.now() },
1356-
],
1357-
clineMessages: [], // No active task
1358-
})
1359-
1360-
// Wait for component to render and show DismissibleUpsell
1361-
await waitFor(() => {
1362-
expect(getByTestId("dismissible-upsell")).toBeInTheDocument()
1363-
})
1364-
})
1365-
1366-
// kilocode_change skip
1367-
it.skip("shows RooCloudCTA when user is not authenticated and has run 5 tasks", async () => {
1368-
const { getByTestId } = renderChatView()
1369-
1370-
// Hydrate state with user not authenticated and 5 tasks
1371-
mockPostMessage({
1372-
cloudIsAuthenticated: false,
1373-
taskHistory: [
1374-
{ id: "1", ts: Date.now() - 4000 },
1375-
{ id: "2", ts: Date.now() - 3000 },
1376-
{ id: "3", ts: Date.now() - 2000 },
1377-
{ id: "4", ts: Date.now() - 1000 },
1378-
{ id: "5", ts: Date.now() },
1331+
{ id: "1", ts: Date.now() - 6000 },
1332+
{ id: "2", ts: Date.now() - 5000 },
1333+
{ id: "3", ts: Date.now() - 4000 },
1334+
{ id: "4", ts: Date.now() - 3000 },
1335+
{ id: "5", ts: Date.now() - 2000 },
1336+
{ id: "6", ts: Date.now() - 1000 },
1337+
{ id: "7", ts: Date.now() },
13791338
],
13801339
clineMessages: [], // No active task
13811340
})

0 commit comments

Comments
 (0)